Closed jschr closed 5 years ago
@jschr thanks for digging in. This is a conundrum. Is the warning chrome gives a console.warn
? I am open to breaking changes in a v4 release, but want to better understand how we can solve this without sacrificing using localStorage as a default storage backend.
I suspect we should lazily create the asyncLocalStorage backend only if a storage is not provided in the persistStore config.
Unfortunately just accessing window.localStorage
will show an error in the console, app still works fine though. Lazy loading sounds like it good solution without breaking existing behaviour.
This hasn't been responded to in a long while, so I'm going to mark it as stale. Please feel free to continue the conversation and I'll reopen.
Currently redux-persist automatically sets up the default local storage backend. This causes a warning when using inside a chrome app because window.localStorage is replaced by chrome.storage.local. To workaround the warning I had to import persistStore and autoRehydrate manually. I also decided to remove the keyPrefix which isn't necessary for this storage as mentioned in https://github.com/rt2zz/redux-persist/issues/137 (let me know if thats a bad idea).
In case this helps anyone else here is a gist of the chromeLocalStorage backend
I guess this isn't so much of an issue as fixing the warning would be a breaking change. Feel free to close or recommend a better place to post this (Wiki?)