question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should `useStorage` really be `true` by default?

See original GitHub issue

We currently default useStorage to true, which might be okay, but does tend to make the examples clobber each other.

Other options:

  • simply make useStorage default to faslse
  • add a storageKey prop 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:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
JaredReisingercommented, May 26, 2020

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.

1reaction
JaredReisingercommented, Aug 14, 2020

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found