Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Old query data loaded, even though the redux store was cleared #890

Closed
akomm opened this issue Jul 24, 2017 · 17 comments
Closed

Old query data loaded, even though the redux store was cleared #890

akomm opened this issue Jul 24, 2017 · 17 comments

Comments

@akomm
Copy link
Contributor

akomm commented Jul 24, 2017

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
@stale
Copy link

stale bot commented Aug 15, 2017

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!

@stantoncbradley
Copy link

Related to #807?

@akomm
Copy link
Contributor Author

akomm commented Aug 22, 2017

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

@stantoncbradley
Copy link

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

@du5rte
Copy link

du5rte commented Aug 23, 2017

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

@stale
Copy link

stale bot commented Sep 13, 2017

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!

@akomm
Copy link
Contributor Author

akomm commented Sep 14, 2017

@jbaxleyiii still relevant

@dozoisch
Copy link
Contributor

Having this issue as well

@stale
Copy link

stale bot commented Oct 5, 2017

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!

@Ardhimas
Copy link

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.

@stale
Copy link

stale bot commented Nov 15, 2017

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!

@dozoisch
Copy link
Contributor

(this should probably not be closed by staling)

@akomm
Copy link
Contributor Author

akomm commented Nov 16, 2017

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

@medeeiros
Copy link

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

@medeeiros
Copy link

#1281
#976
apollographql/apollo-client#1186
apollographql/apollo-client#1387

At least 4 issues related to this.

@ghost
Copy link

ghost commented Dec 9, 2017

Same here.

@rosskevin
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants