mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-18 00:56:30 +03:00
Clear the render clock when a poll generation goes stale
Follow-up to the generation stamp: both probe callbacks returned on a stale generation without clearing the elapsed-time interval. tryLoad clears it on re-entry, but a probe that finishes stale schedules no re-entry, so flipping back while one was in flight left the interval ticking for the rest of the page's life. Both exits now clear it, which is what the isConnected guard above them already did. Written with AI assistance (Claude Code). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f2f1cdb0bb
commit
1f0169d126
@@ -1076,7 +1076,11 @@ ${buildPath?.toggle ? `<div id="bp-confirm" role="dialog" aria-modal="true" aria
|
||||
if (!m.isConnected || !m.classList.contains('comp-pending') || !current()) { clearInterval(tick); return; }
|
||||
const probe = new Image();
|
||||
probe.onload = () => {
|
||||
if (!current()) return;
|
||||
// A stale generation also ends this run's clock. tryLoad clears it on
|
||||
// re-entry, and an in-flight probe that finishes stale schedules no
|
||||
// re-entry, so returning without clearing ran the interval for the rest
|
||||
// of the page's life.
|
||||
if (!current()) { clearInterval(tick); return; }
|
||||
landTracker.last = Date.now();
|
||||
const target = m.querySelector('img.comp') || img;
|
||||
target.src = probe.src;
|
||||
@@ -1084,7 +1088,7 @@ ${buildPath?.toggle ? `<div id="bp-confirm" role="dialog" aria-modal="true" aria
|
||||
settle();
|
||||
};
|
||||
probe.onerror = () => {
|
||||
if (!current()) return;
|
||||
if (!current()) { clearInterval(tick); return; }
|
||||
const quiet = Date.now() - landTracker.last > 240000;
|
||||
if (Date.now() - started > 240000 && quiet && fallback()) return;
|
||||
setTimeout(tryLoad, m.classList.contains('stand-in') ? 5000 : 2500);
|
||||
|
||||
Reference in New Issue
Block a user