addon API for storing state per-session or per-app.
See original GitHub issueIssue: we removed the use of URL params for storing state. This will be an issue if apps reload (e.g. because HMR isn’t working right, see for instance https://github.com/storybooks/storybook/issues/5267).
Right now we have an adhoc way of using session/localStorage
for storing things. We also have retained setQueryParams
but it no longer actually affects the URL so will not survive reloads etc.
We should resolve this for v5.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
addon API for storing state per-session or per-app. · Issue #5271
Issue: we removed the use of URL params for storing state. This will be an issue if apps reload (e.g. because HMR isn't...
Read more >WCF: Using Transactions to Manage State and Error Recovery
Between transactions, the service should store its state in a resource manager. At the beginning of each transaction, the service should retrieve its...
Read more >Stores: Making State Global Without React's Context API
In this article we're going to explore some drawbacks of context-based state in typical application architecture, then explore an ...
Read more >Saved State module for ViewModel - Android Developers
For state that is used in business logic, hold it in a ViewModel and save it using SavedStateHandle . For state that is...
Read more >React Context for dependency injection not state management
Dive into the concept that React Context API is primarily a tool for ... Technically, Context allows storing a value, reading a value, ......
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
@shilman, this is not working in the beta.1 version. (not sure about the prior versions)
For example, in a decorator I call
api.setQueryParams({ test: 'abc' })
. The URL is not changed and the subsequent call both (console.dir(api.getUrlState())
andconsole.dir(api.getQueryParam())
) was not showing the query parameter I provided…Any clue or should I open a new issue?!
Here’s what I sketched out in my head:
What if we update
setState
to have the signature:When we
setState
, we may also save a “subset” of the state intosessionStorage
andlocalStorage
based on the above.When we initialize the state, we will combine:
forever
statesession
stateMerging them with preference in that order (i.e.
session
>forever
> defaults)