-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Queries for unmounted components getting called after calling a mutation and resetStore. #1773
Comments
Hi @jinxac, thanks for filing an issue. It sounds like this could be a bug in Apollo Client. Would you be able to provide a reproduction using the error-template? That would help us get to the bottom of the issue much quicker. Thanks! |
yeah sure, let me try doing that |
Hi @helfer I debugged this issue a little further by creating a new project itself and observed that it is not linked to mutations at all. Yeah that was bit of a surprise. The actual issue is that the So instead of I will go ahead and close this issue for now. Thanks for your help :) |
@jinxac ok, glad you figured it out and thanks for telling us what the issue was! This will be helpful for other people who end up in the same situation! |
Hi @jinxac, would love to have more details on the react-navigation side as I am facing the same problem... |
@sabativi sure would love to help. Can you help me understand the issue once? |
It seems that |
We have an application built up on react-native, apollo and graphql. The application is a fintech app which contains a dashboard with list of portfolios, the user choose the portfolio, goes to payment page and can make payment after which he is redirected to dashboard.
We were looking to clear cache on login for handling multi user behavior. We tried implementing
resetStore
. This works fine when only queries were involved i.e. for unmounted components the queries were not called onresetStore
. This was as according to #1319 and the fix apollographql/react-apollo#671.When we placed the order (createOrderMutation) and then tried calling
resetStore
; user got logged out; then we tried logging in from a different user. At this point few of the queries are called on resetStore(dashboard query, portfolioDetailQuery, paymentScreenQuery etc..). Ideally no queries should be called beyond dashboardQuery as that is the only component that is currently mounted.Intended outcome:
Queries for unmounted components should not get called after calling a mutation and
resetStore
Actual outcome:
Queries for unmounted components are getting called after calling a mutation and
resetStore
How to reproduce the issue:
We have 3 screens:-
Scenario:-
resetStore
is called -->unmounted components queries are called
The text was updated successfully, but these errors were encountered: