React-apollo: Old query data loaded, even though the redux store was cleared

Created on 24 Jul 2017  路  17Comments  路  Source: apollographql/react-apollo

Reproduce:

  • Make sure you run apollo state in your own redux store
  • Execute a query via graphql HOC mounting successfully & ensure it is in store
  • Clear the store & ensure it is cleared
  • Execute the query again ~provoking any error~ - just execute it, no error needed.

Expected result:

No data from the query passed through the graphql HOC

Actual result:

Data, which was successfully loaded before store clear..

I'm trying to make a test reproducing it. My current assumption is that the observable is leaking data.

update 1
Checked the code. It looks like the apollo client has state outside the actual redux state, which is not cleared/reset, when you reset the redux state. Its coming from active observables. And using the ApolloClient.resetStore API is, as documented, not really resetting the data, but refetching queries.

So when you have authorized APIs you can not return errors, you have to return blank results to make this work, or else whenever you logout a user and clear using resetStore, you get 100 errors everywhere. Else: when you clear via redux HOR or dispatching APOLLO_STORE_RESET, data is leaked through observables via last result.

This is totally flawed :(

Version

  • apollo-client@^1.4.0
  • react-apollo@^1.4.0
bug discussion

Most helpful comment

(this should probably not be closed by staling)

All 17 comments

This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!

Related to #807?

Yes, the "load old data on error" part is related to #807, additional to the issue not being able to clear data properly.

yes this is a big problem for us. we had to roll back to 1.1.3

Experiencing the same here also had to roll back to ~1.1.0

This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!

@jbaxleyiii still relevant

Having this issue as well

This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!

Is there anyone actively working on a PR for this issue, or at least know what to do to solve it? This is a pretty severe bug for any apps that involve authentication and user data.

This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!

(this should probably not be closed by staling)

Maybe the bot should ignore bug-tagged issues and only stale issues untagged or tagged with something like "waiting for response".

Same here. And it's a big issue for us.

Same here.

Redux stores are no longer in use - closing - housekeeping.

Was this page helpful?
0 / 5 - 0 ratings