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

MergeItem for ReactNative? #28

Open
hayyaun opened this issue Mar 2, 2021 · 4 comments
Open

MergeItem for ReactNative? #28

hayyaun opened this issue Mar 2, 2021 · 4 comments

Comments

@hayyaun
Copy link

hayyaun commented Mar 2, 2021

Hi, I faced an issue for persisting multiple atoms when I set them right after each other, how can I fix this problem?

@polemius
Copy link
Owner

polemius commented Mar 3, 2021

@hayyaun Thank you for rising the issue! Could you please provide some code?

@hayyaun
Copy link
Author

hayyaun commented Mar 3, 2021

Hi, I tried another solution, by separating each state at a unique key in storage. This was the only solution I found for react native up to now. I'm waiting for your next version to come.

My code was something like this:

setUser({ ... });
setProducts({ ... });

In this case, since they were trying to be stored syncly, and the current state retrieved from storage is not updated would end up one state not to be saved properly.

@dpalay
Copy link

dpalay commented Mar 5, 2021

I ran into something similar, setting multiple atoms that shared the same persistAtom then the save of the last one would overwrite the save of the first one. My current fix is to give all of them different persistAtoms

@polemius
Copy link
Owner

@hayyaun I have released 2.9.0 version with using mergeItem function. Please check it out

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

3 participants