Should `useStorage` really be `true` by default?
See original GitHub issueWe currently default useStorage to true, which might be okay, but does tend to make the examples clobber each other.
Other options:
- simply make
useStoragedefault tofaslse - add a
storageKeyprop so that crossword instances can have unique storage
If we do the second option, we could potentially omit useStorage entirely; the presence of storageKey would mean “use storage”.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
useStorage
By default, useStorage will use the value from storage if it presents and ignores ... When setting it to true, it will perform...
Read more >Vue useStorage (usevue) always starting clean rather than ...
I watch it set the data (in Chrome's dev tools), but it always reloads the default data instead rather than persisting between refreshes....
Read more >Persist store throughout page reloads · Issue #309 · vuejs ...
And it seems to work, EXCEPT, $reset() doesn't appear to actually reset to the default value (seems to be a NoOp). I am...
Read more >In what cases would I set a parameter to use storage ...
A storage parameter does not really mean your data is copied into storage . All parameters are actually stored on the stack. Since...
Read more >Managing React state with Zustand
import create from 'zustand' const useStore = create(set => ({ bears: 0, ... by default, this is localStorage , but you can also...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

No updates per se. I’ve pretty much come to the same conclusion as you, that “guesses are saved by default” is the right answer at least 90% of the time. My plan going forward would be to allow consumers to pass a storageKey prop to override the default to, for instance, handle cases with more than one Crossword shown at a time, or shown at the same URL.
The page (URL) has unique storage… so if you have Crosswords at different URLs, the data won’t collide. I have not (yet) added a ‘storageKey’ prop to allow multiple Crosswords on a single page (at a single URL).
If this is something you need, please feel free to open an issue asking for it! (I wanted to close this issue to keep the concepts separate and not conflated.) Thanks!