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
Discussion: adds local storage clearing #155
base: main
Are you sure you want to change the base?
Conversation
Nice! I think this is a good thing to implement if people are having problems with the |
That makes sense! Yeah after Lucas' comments I did some research and indeed it doesn't seem as a very important issue at the moment. I guess it's mostly feeling there's potentially too much stuff left in localStorage haha |
@@ -135,6 +135,18 @@ function useLocalStorageState(key, initialState, clean) { | |||
return [value, setValue, remove]; | |||
} | |||
|
|||
function clearLocalStorage() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also take an optional argument so it can be used to delete a very specific local storage entry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
@@ -96,7 +96,7 @@ function undoReducer(state, action) { | |||
const getNewSeed = () => seedrandom(null, { pass: (_, seed) => ({ seed }) }).seed; | |||
|
|||
export function useSeedHistory(functionName) { | |||
const key = `--${functionName}-seed`; | |||
const key = `mechanic_seed_${functionName}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the mechanic_
prefix is used in multiple places now I think this should be a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
✅ Deploy Preview for dsi-logo-maker ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Moving a conversation started in #150 here:
One thing that worried me about the #140 was that it maybe resets values for the inputs too frequently, even if it's not needed in certain scenarios. Like maybe an number input value I tweaked into a very specific value already in the UI, but if I tweak the max value in the definition it will reset the current value. But of course, what if that max value is smaller than the current value? There may be a lot of edge cases that are weird to control, but at some point we could introduce smarter resets. The current setup is simpler in that sense.
But another thing I worry it introduces is adding much more new entries in local storage. I started worrying back when we introduced seed history storage, cause this too already seems like a lot saved there. So here I also add a little clearLocalStorage function that could be called from the UI in certain scenarios (like debugging or something crashes and we add to the error log that they can clear it). Tho I don't know yet how or where to add that in the UI. Any ideas welcome :)
Lucas thoughts:
I'm just leaving some initial ideas here: