Open Arno500 opened 6 months ago
Thanks @Arno500! This is super useful. We'll dig into it when we can 🙂
Thank you for your time, first ;) !
Some notes while playing around with the reproduction:
Seems the issue is related to React transitions. If I remove the startTransition
around the fetchMore
call, the list is updated as expected. I'll have to dig into this a bit more to understand what's happening under the hood. Here is my fork of the reproduction which shows that removing the startTransition
will render the list as expected.
Issue Description
Hello, I noticed that when trying to loop on results to get multiple pages from a query, if we are too fast (like just after the render), the data property returned does not update. In the reproducer, you can see that the fetch is properly triggered using a
useEffect
at the beginning, thenewData
are fetched properly, but the cache is not updated at all, thus never causing theuseEffect
to run again.Link to Reproduction
https://stackblitz.com/edit/stackblitz-starters-t7c2zv?file=src%2Fcomponents%2FPaginatedQuery.tsx,src%2Fapp%2Flayout.tsx
Reproduction Steps
@apollo/client
version3.9.5