Discussion: adds local storage clearing#155
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 |
| return [value, setValue, remove]; | ||
| } | ||
|
|
||
| function clearLocalStorage() { |
There was a problem hiding this comment.
Should this also take an optional argument so it can be used to delete a very specific local storage entry?
|
|
||
| export function useSeedHistory(functionName) { | ||
| const key = `--${functionName}-seed`; | ||
| const key = `mechanic_seed_${functionName}`; |
There was a problem hiding this comment.
Given that the mechanic_ prefix is used in multiple places now I think this should be a constant.
✅ 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: