Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkStorageAvailability = true overwrites specified storage #140

Open
zerodexter82 opened this issue Feb 17, 2020 · 1 comment
Open

checkStorageAvailability = true overwrites specified storage #140

zerodexter82 opened this issue Feb 17, 2020 · 1 comment

Comments

@zerodexter82
Copy link

I'm trying to use this library to sync parts of my store to sessionStorage.
The project uses SSR so we need to check for availability of storage.
Unfortunately, it seems impossible to use the "storage" and "checkStorageAvailability" config options at the same time, because this code in localStorageSync function:
if (config.storage === undefined && !config.checkStorageAvailability || (config.checkStorageAvailability && checkIsBrowserEnv()) ) { config.storage = localStorage || window.localStorage; }

will override config.storage to use localstorage if(config.checkStorageAvailability && checkIsBrowserEnv()).

Does anyone have alternative ideas on how to run this metaReducer conditionally only if inside a browser environment, with sessionStorage instead of localStorage?

@dmitry-kostin
Copy link

It doesn't work for me either,
they check IsBrowserEnv via

typeof window !== 'undefined'

but i have mocked window via domino in server.ts, so this check makes no sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants