You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug infiniteQuery continues to iterate and fetch all pages even after there are no more observers to consume the data. If the infiniteQuery contains a large set of pages (i.e. 100) this causes unnecessary network load and keeps references to variables for a long time.
To Reproduce
Steps to reproduce the behavior:
Open sample in CodeSandbox
Allow all pages to finish loading (up to 15 pages).
Open Console tab (bottom right) in CodeSandbox or browser console
Sample app will print Fetched page every time an API call is simulated
Click on Toggle button to unmount the component which calls useInfiniteQuery
Notice even though there are no more observers which consume the components query the infiniteQuery continues to fetch pages in the background.
Expected behavior
After all observers (i.e. React components) which consume an infiniteQuery go out of scope the infiniteQuery should stop fetching subsequent pages.
Screenshots
Desktop (please complete the following information):
OS: all
Browser: all
Version: all
Smartphone (please complete the following information):
Gave a staleTime of 1000 * 60 * 60 but then also it's fetching
Khufu-I
changed the title
infiniteQuery continues to refetch data even there are no more observers
infiniteQuery continues to refetch data even if there are no more observers
Dec 28, 2020
@boschni Thank you for addressing this issue. I noticed that with the latest update the CodeSandbox sample shows an error after the infinite query is cancelled and the React component is rendered again.
Please let me know if I've to change my code to consume the new changes.
Describe the bug
infiniteQuery
continues to iterate and fetch all pages even after there are no more observers to consume the data. If theinfiniteQuery
contains a large set of pages (i.e. 100) this causes unnecessary network load and keeps references to variables for a long time.To Reproduce
Steps to reproduce the behavior:
Open sample in CodeSandbox
useInfiniteQuery
infiniteQuery
continues to fetch pages in the background.Expected behavior
After all observers (i.e. React components) which consume an infiniteQuery go out of scope the infiniteQuery should stop fetching subsequent pages.
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Possible code that controls this behaviour
The text was updated successfully, but these errors were encountered: