Way to turn off storage by default
See original GitHub issueI was using little-state-machine
with react-hook-form
and had some conditional state that I didn’t want lsm to remember on load.
The only way I found to implement this was something like this:
const initialState = {/* whatever you want */}
createStore(
{ ...initialState },
{
middleWares: [],
syncStores: {
// you can sync with external store and transform the data
externalStoreName: 'initial',
transform: ({ externalStoreData, currentStoreData }) => {
return {
...initialState,
// here add any other state from external or current
};
}
}
}
);
I actually really like this package a lot and would be happy submitting a PR for what I’m thinking, unless I’m not on the right track.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to turn off Storage Sense in Windows 10 — Auslogics Blog
Method 1: How to Disable Storage Sense Using the Settings App ; Launch the “Settings” app using the Win + I shortcut. Launch...
Read more >Manage drive space with Storage Sense - Microsoft Support
Go to Start > Settings > System > Storage . Select Storage Sense. Choose your desired settings, including when to run Storage Sense,...
Read more >Free up space - Android Help - Google Support
Free up storage · Close apps that don't respond · Uninstall apps you don't use · Clear the app's cache & data ·...
Read more >How to enable, disable, or clear your browser's "Web Storage ...
To enable or disable Web Storage in Internet Explorer: ... Select Extras → Internet Options → Advanced Tab → Go to Security →...
Read more >How to Enable and Configure Storage Sense on Windows 11
Once you have Settings open, click System from the list on the left. Then, on the right, scroll down and click Storage. system...
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 FreeTop 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
Top GitHub Comments
I was able to by setting both
getItem
andsetItem
:oh you probably can use
setStorageType
and give it an object with session storage alike API.call
setStorageType({ setItme: () => {}, ...})
beforecreateStore
basically save data into an object in memory instead of session/local stroage.