When loading state on app init I get data from different app #153
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MichaelContento/redux-storage#153
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm building two apps and I'm using your package in both of them.
I have noticed that if I have the same save-key in both of the apps you will get the first apps data in the second app. So you load wrong data in the app. It should not be possible to load in data from another app to you app or am I missing something?
Hi,
this completely depends on the redux-storage-engine you use!
For all engines I've created (for example redux-storage-engine-localstorage) your observation is indeed true.
In the case of redux-storage-engine-localstorage the scoping is only based on the browsers behaviour of
localStorage.getItemandlocalStorage.setItem. So if you host both redux apps under the same domain the keyspace is shared.With redux-storage-engine-reactnativeasyncstorage the scoping should be based on the appId (I haven't doubled checked this).
So from
redux-storagepoint of view this detail is 100% in the hand of the engine. And for all my engines this behaviour is "by design". 😄Is there anything wrong with this? Is there a special case why you host two different apps under the same domain? Is there anything that forces you to use a single save-key for multiple apps?
Hmm, okey.
I use the redux-storage-engine-reactnativeasyncstorage. And it's no actual problem for me using two different save-keys. This is what I'm doing now. 😄
But it feels wrong that i could get access to the first apps data from the second app. If that would happen with other apps on the users phone it's pretty bad.
If redux-storage-engine-reactnativeasyncstorage scopes on appId, this should not be able to happen?
Hm ..
redux-storage-engine-reactnativeasyncstorageis simply based onAsyncStorage.getItemandAsyncStorage.setItem(as you can see here). I haven't double checked this but I would assume that react-native keeps theAsyncStorageseperated by app.If there is something wrong and/or buggy, please report this issue to the react-native team!
Okey, will dig a bit deeper in to it. Thanks for the quick replies! 👍 🎉