Replies: 1 comment
-
local state combined with an updater from
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a query that, depending on the data that is returned, needs to be refetched sooner than usual.
E.g., the data returned could contain a field 'stillComputing' to indicate that the result is not finished yet, and you should ask for the result again 'soon'.
My initial intuition would be to be able to pass a function to a query's
refetchInterval
which takes the current data, and returns a number depending on the data (in the above case e.g. 5 seconds when thestillComputing
field is set, orundefined
otherwise), but according to the docs, that doesn't work.The imperative way is to start a timer and call refetch() on the query (which isn't that bad if you have hooks to do this), but I was wondering if there was a declarative way.
Beta Was this translation helpful? Give feedback.
All reactions