Comments (4)
@phryneas , with your PR release tests are now working flawlessly!
Thx a lot, @phryneas, @alessbell! You are awesome! Looking forward to pull in the fix release!
from apollo-client.
For background - the purpose of this timeout is to batch cleanups of "memoized cache" cleans.
If your cache is full and you add 20 more items, you don't want to call .clean()
20 times, but only once, with a little bit of a delay.
That said, until now we scheduled these always, not only when the cache was full. I've opened #11792. Since your tests are unlikely to fill these caches, that should fix it for your usecase.
Could you please test the PR release and report back if it fixes your problem?
npm i @apollo/[email protected]
from apollo-client.
Hi @vz-tl 👋 Thanks for the report here.
I was able to reproduce this by wrapping this test in the apollo-angular
repo with fakeAsync
.
The setTimeout
in schedule
auto-schedules cleanup of a particular cache (an AutoCleanedWeakCache
) when a new item is added, and is throttled to once per 100ms. Clearly this additional microtask is incompatible with your test, but I hope you'll agree it's doing important work :) I'll cc: @phryneas there for any more context he'd like to add.
To unblock your upgrade to 3.9, you can call flush with flush(1)
(or flush(2)
- not being able to see your test it's hard to say what's causing both) at the end of your test so that only a single microtask is drained from the queue (if there are any more remaining your test will still fail).
I hope that explanation is helpful - I'll leave this open for now in case anyone else on the team has something to add.
from apollo-client.
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.
from apollo-client.
Related Issues (20)
- [Testing utilities] Docs HOT 1
- [Testing utilities] Call `createMockSchema` from within `createTestSchema` HOT 2
- [Testing utilities] Create separate entrypoint for new testing utilities HOT 3
- `MockLink` doesn't work with `@nonreactive` directive. HOT 2
- [Tests] Investigate flaky test in `src/link/persisted-queries/__tests__/persisted-queries.test.ts`
- subscribeToMore unsubscribes after partial error HOT 3
- `useFragment` doesn't respect the `@nonreactive` directive HOT 2
- `ApolloError.graphQLErrors` are not of type `GraphQLError` HOT 2
- useQuery fails to resolve ssr renderPromise due to JSON.stringify reordering HOT 6
- useSuspenseQuery returns an error instead of throwing an exception HOT 6
- Initializing ApolloClient before DataDog RUM causes GraphQL calls to not have the correct headers HOT 4
- Skipped Query returns outdated data after cache clearing HOT 6
- Merge function at the type level not working (+ suggested fix) HOT 12
- Unexpected Data Fetching with `useBackgroundQuery`, StrictMode, `fetchPolicy`: `network-only` (or `no-cache`), and state changes HOT 5
- When use the Apollo Client server side rendering, How to share the cache in cluster server (k8s)? ( did we have file cache? or db cache? ) HOT 2
- Feedback for schema-driven testing utilities HOT 1
- Add `subscribeToMore` functionality to `useQueryRefHandlers`, `useBackgroundQuery`
- [Docs] Anchor links seem to be stripped HOT 4
- Incomprehensible type mismatch with query generics HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-client.