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

ApolloStore#clearAll method does not trigger changes to watchers #2532

Open
Tracked by #2331
piotr-pawlowski opened this issue Aug 21, 2020 · 7 comments
Open
Tracked by #2331

Comments

@piotr-pawlowski
Copy link

Summary
It is the same problem with remove method - it does not trigger event as well. #2505

Version
All versions.

@martinbonnin
Copy link
Contributor

Similarly to #2505, I guess we need a clearAllAndPublish?

@piotr-pawlowski
Copy link
Author

Yes, it seems to be the best solution.

@Hospes
Copy link

Hospes commented Jul 11, 2024

any updates here ?
seems like still apolloStore.clearAll() doesn't trigger publish and observers don't show empty results

@BoD
Copy link
Contributor

BoD commented Jul 11, 2024

@Hospes At the moment clearAll() still doesn't publish to observers, so you'll need to handle that with your own mechanism. I've added this issue to the backlog of issues we want to tackle as part a cache improvement effort.

@jszmltr
Copy link

jszmltr commented Dec 19, 2024

Hi @BoD is there any updates on this ? 👀

@BoD
Copy link
Contributor

BoD commented Dec 19, 2024

Hey @jszmltr thanks for the ping! The issue is still there, but I'll have a look to at least determine what would be needed to have this fixed. In the meantime manually calling ApolloStore.publish with a select set of keys is probably your best bet.

@BoD BoD changed the title ApolloStore#clearAll method does not trigger changes to ApolloStore.RecordChangeSubscriber ApolloStore#clearAll method does not trigger changes to watchers Dec 19, 2024
@BoD
Copy link
Contributor

BoD commented Dec 20, 2024

With #6337 you can call publish() with a special key set ApolloStore.ALL_KEYS after your call to clearAll(). This will notify all watchers. This will be in the next release, in the meantime it can be tried out with the snapshots.

@BoD BoD added this to the 4.1.1 milestone Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants