Can't use refetchInterval
and setQueryData
together
#5132
-
I have a query that should be re-fetched every X seconds. The solution is to use In my case, I have a websocket connection that updates part of a query data every 100 milliseconds. If the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi 👋 This is an interesting one. As far as I'm aware, the interval is intentionally reset when the query is programmatically updated as this indicates that the query has just been updated. This usually makes sense, as you usually wouldn't want to programmatically update a query and then run the query function 1ms later, for example. I wonder if you might need to implement this imperatively, or if there's some way to disable this behaviour that I'm not aware of. Sorry I can't be of more help but hopefully someone who knows more about the system than me can shed some light 🙂 |
Beta Was this translation helpful? Give feedback.
-
I also need this function, is there any way to do it? |
Beta Was this translation helpful? Give feedback.
Hi 👋
This is an interesting one. As far as I'm aware, the interval is intentionally reset when the query is programmatically updated as this indicates that the query has just been updated. This usually makes sense, as you usually wouldn't want to programmatically update a query and then run the query function 1ms later, for example.
I wonder if you might need to implement this imperatively, or if there's some way to disable this behaviour that I'm not aware of.
Sorry I can't be of more help but hopefully someone who knows more about the system than me can shed some light 🙂