-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Store doesn't persist data after rebuilding it when logging out #111
Comments
Hi @high-performance-hery, |
We do call |
Add the log to understand if the new environment has been restored and if the mutation is performed in the new enrivonment |
Otherwise, create a small sample project where the problem occurs so that I can help you |
So the new environment has been restored and the mutation is performed in the new environment. However it looks like the first mutation updates the store correctly, but the UI doesn't get updated. So subsequent mutations just send the same mutation as the initial one and no more updates occur. After restarting the app, mutations behave normally. So it looks like we set up the Relay store and environment correctly, but there's an issue with the way we hook up the UI? |
I tried to modify the example project by adding a button that makes a new "login" and everything seems to work correctly. |
Looks good, thanks! It looks like a setup issue on our end: queries go to the old store and mutations go to the new one, which is why the UI doesn't update when the store updates. |
Is there a store property we can watch in the logs to differentiate them? I'm currently using relay-devtools to watch which store events go througgh but it isn't the most convenient |
Do I need to update the RelayEnvironmentProvider on logout? Doing this via a state update is tricky, since there is a place where I need to use our logout function imperatively (i.e. outside a component render function). Previously I had just been clearing async storage/access token and running buildEnvironment. Is there a workaround in this case? |
Yes you have to update it, otherwise the application does not log out completely, in fact it uses the enviroment associated with the old user. It is difficult for me to give you advice on how to do this in your case. |
Yea sounds quite specific to our setup. Would there be a problem with updating the env when logging in or signing up rather than logging out? |
No problem, but you must avoid that the application uses the old environment in the meantime |
When logging out, we rebuild a new environment like this:
but the issue is that mutations aren’t updating the store until we hard restart the app.
Is there anythign specific we need to do when logging out?
The text was updated successfully, but these errors were encountered: