Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseInt(new_scratch_preset) #908

Merged
merged 6 commits into from
Nov 13, 2023
Merged

parseInt(new_scratch_preset) #908

merged 6 commits into from
Nov 13, 2023

Conversation

mkst
Copy link
Collaborator

@mkst mkst commented Nov 1, 2023

looks good locally (and on Vercel)... the initial preset state is "Custom" but as soon as a platform is selected, the Preset works (for all platforms) - I dont know whether we care enough about that?

Fixes #907.

@bates64
Copy link
Member

bates64 commented Nov 1, 2023

We should probably handle the initial case where parseInt returns NaN

@mkst
Copy link
Collaborator Author

mkst commented Nov 1, 2023

bleurgh.

@mkst
Copy link
Collaborator Author

mkst commented Nov 1, 2023

I give up :)

@mkst
Copy link
Collaborator Author

mkst commented Nov 2, 2023

nah this change is junk.

@mkst mkst force-pushed the fixup-preset-id-localstorage branch from 54acd42 to 1d3469c Compare November 2, 2023 11:00
@mkst
Copy link
Collaborator Author

mkst commented Nov 12, 2023

Right. am finally happy with this. I dont know if there is a better way that would replace the need for the ready var?

Copy link
Member

@bates64 bates64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for now. A better way to do this in future is probably to make a useLocalStorageState hook that wraps useState and useEffect to load/store into localStorage automatically

@ethteck ethteck merged commit c6a9a41 into main Nov 13, 2023
@ethteck ethteck deleted the fixup-preset-id-localstorage branch November 13, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PresetId in new scratch page is not being saved in localStorage correctly.
3 participants