How to use function version of refreshInterval that depends on data response? #2134
-
The refreshInterval?: number | ((latestData: Data | undefined) => number); If e.g. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Looks like I defined the useSWR<Awaited<ReturnType<typeof getProfile>> | undefined> I confirm I can use the |
Beta Was this translation helpful? Give feedback.
Looks like I defined the
Data
type incorrectly and should haveAwaited
the response of the fetcher:I confirm I can use the
refreshInterval
function version and return0
based on the resolved value ofgetProfile
which gets passed torefreshInterval
function (as a resolved value).