mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-20 22:22:57 +03:00
The auto-refresh interval gated each tick on visibleRef, seeded once at mount and updated only by a visibilitychange event. A tab mounted while document.visibilityState is 'hidden' (background load, bfcache, embedded/proxied webviews) with no later visibilitychange left the ref false forever, so the interval ticked but never fetched — only the manual button worked. Read the live document.visibilityState in the tick instead.
This commit is contained in:
committed by
GitHub
parent
074f6188de
commit
bb40fbba09
@@ -283,7 +283,12 @@ const RequestLoggerV2 = forwardRef<RequestLoggerV2Handle, { initialSelectedId?:
|
||||
if (intervalRef.current) clearInterval(intervalRef.current);
|
||||
if (!selectedLog && shouldAutoRefresh(recording, limit, PAGE_SIZE)) {
|
||||
intervalRef.current = setInterval(() => {
|
||||
if (visibleRef.current) fetchLogs(false);
|
||||
// #3972: read live visibility each tick, not a mount-time ref. A tab
|
||||
// mounted while "hidden" with no later `visibilitychange` left the ref
|
||||
// false forever, so auto-refresh never ran (only the manual button did).
|
||||
if (typeof document === "undefined" || document.visibilityState === "visible") {
|
||||
fetchLogs(false);
|
||||
}
|
||||
}, refreshIntervalSec * 1000);
|
||||
}
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user