Svelte-Query reactive createQuery
refetches despite key values not changing
#5603
Labels
createQuery
refetches despite key values not changing
#5603
Describe the bug
I'm using Skeleton Paginators along with svelte-query to control a paginated table of data. I'm finding that whenever the Skeleton paginator mounts it sets my pagination settings object (containing the data limit and offset) to a clone of itself causing reactive statements using these settings to run.
I set up
createQuery
using a reactive statement with a key based on the pagination settings. I want to disable my paginator while data is loading so I used$query.isRefetching
to render a loading spinner instead. The issue is that whenisRefetching
goes to false once the data laods my paginator renders and setssettings
causing the reactive statement declaring the query to rerun and enter theisRefetching
state again creating an infinite loop.Your minimal, reproducible example
https://github.com/ferntheplant/tanstack-repro
Steps to reproduce
See repro README
Expected behavior
I would expect the query to NOT enter the
isRefetching
state once the reactive statement runs because the query key values have not changed.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
svelte-query
TanStack Query version
v4.29.14
TypeScript version
v5.0.0
Additional context
Discord discussion link
The text was updated successfully, but these errors were encountered: