-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
focusThrottleInterval is not honoured for the first refresh on focus after mount #2856
Comments
Some additional info: https://github.com/mgoodfellow/swr_revalidate_test/blob/master/swr-revalidate-test/src/pages/index.tsx#L15 It seems this value is honoured for subsequent requests, but the initial focusThrottleInterval after a page load is the default of 5s |
Right, I see the issue: Line 594 in 1d81109
The This effect is then repeated on a remount (such as due to a page change). I guess ideally we need to calculate the next possible revalidation window due to focus, when it initially mounts. Line 579 in 1d81109
|
So updating my example from the initial repo: mgoodfellow/swr_revalidate_test#1 This uses the built libraries from the PR I opened above, and the behaviour is now as expected: That initial refresh does not occur, and then the refresh on focus after 60s is allowed |
Bug report
Description / Observed Behavior
It seems that sometimes
focusThrottleInterval
is not honouredExpected Behavior
I expected it to be honoured
Repro Steps / Code Example
https://github.com/mgoodfellow/swr_revalidate_test
Additional Context
SWR version 2.2.4
Add any other context about the problem here
Run repo with
npm run dev
Page loads, cat fact shown.
Click away from window (lose focus)
Wait ~ 10 seconds, click back to window:
If we review this waterfall, we have filtered requests by "cat" so we see the requests for this URL.
We can see the request on the page load, then we see another request ~10s. Surely the focusThrottleInterval should have inhibited this 2nd request from occuring?
The text was updated successfully, but these errors were encountered: