question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

frequent cache writes don't propagate to some observers

See original GitHub issue

reproduction: https://codesandbox.io/s/apollo-client-frequent-cache-writes-lybjy (if empty wait 20 sec for backend to spin up)

The button calls writeFragment twice in separate tasks. Cache looks good always. The issue is some observers don’t get notified if updates come in too fast.

This happens in my app where you get a couple of WS messages with minimal interval. Some components get called twice and therefore have up-to-date cache data, while others get called only once, and their data is stale. This happens with any write method (I tried writeQuery, writeData, writeFragment). Also tried @apollo/client beta, same result.

If there’s more <Box />es, all but the last two update as expected.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alex3dcommented, Nov 12, 2019

You are right.

0reactions
lsnchcommented, Nov 14, 2019

Thanks, the new @beta seems to be working in sandbox, but I can’t make it work in my app.

Hit a couple of roadblocks upgrading…

  • Request redirection. We currently use cacheRedirects, but it seems to be missing in beta.
  • Fragments. Some types of queries fail (maybe field names collide? I don’t know).

Would you be able to expand migration guide on those areas so I can test it in a real app?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cache Consistency Options - Ehcache
Propagation of Modified Data​​ In general, any data cached in the heap is always consistent in that heap. For example, if one thread...
Read more >
LiveData prevent receive the last value when start observing
I don't think it is possible to prevent LiveData from receiving the last value when start observing if you are using them as...
Read more >
objc-cache.mm - Apple Open Source
assertLocked(); // Never cache before +initialize is done if (!cls->isInitialized()) return; // Make sure the entry wasn't added to the cache by some...
Read more >
Smarter Shared Kotlin Flows - Christophe Beyls - Medium
To achieve this, a repository can send an invalidation signal to the observer of the data after each completed write operation (create/update/delete), ...
Read more >
The Complete Guide to Rails Caching - Speedshop
Caching in a Rails app is a little bit like that one friend you sometimes have around for dinner, but should really have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found