mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-20 01:56:37 +03:00
Fix live cleanup races with framework HMR (#695)
Guard delayed accept and discard DOM fallbacks when framework/HMR ownership is present, while preserving static-page cleanup. Add unit/source regressions for both paths and refresh stale Setup wording assertions from #689. AI-assisted: prepared with Codex under @pbakaus direction.
This commit is contained in:
@@ -71,17 +71,38 @@
|
||||
return checkpointRevision;
|
||||
}
|
||||
|
||||
function readHandledIds() {
|
||||
const raw = safeRead(handledKey);
|
||||
if (!raw) return [];
|
||||
try {
|
||||
const parsed = JSON.parse(raw);
|
||||
if (Array.isArray(parsed)) {
|
||||
return parsed.filter(id => typeof id === 'string' && id);
|
||||
}
|
||||
if (typeof parsed === 'string' && parsed) return [parsed];
|
||||
} catch { /* legacy values were stored as a plain session id */ }
|
||||
return [raw];
|
||||
}
|
||||
|
||||
function markHandled(id) {
|
||||
if (!id) return;
|
||||
safeWrite(handledKey, id);
|
||||
const ids = readHandledIds().filter(existing => existing !== id);
|
||||
ids.push(id);
|
||||
safeWrite(handledKey, JSON.stringify(ids.slice(-8)));
|
||||
}
|
||||
|
||||
function isHandled(id) {
|
||||
return !!id && safeRead(handledKey) === id;
|
||||
return !!id && readHandledIds().includes(id);
|
||||
}
|
||||
|
||||
function clearHandled() {
|
||||
safeRemove(handledKey);
|
||||
function clearHandled(id) {
|
||||
if (!id) {
|
||||
safeRemove(handledKey);
|
||||
return;
|
||||
}
|
||||
const remaining = readHandledIds().filter(existing => existing !== id);
|
||||
if (remaining.length > 0) safeWrite(handledKey, JSON.stringify(remaining));
|
||||
else safeRemove(handledKey);
|
||||
}
|
||||
|
||||
function writeScrollY(y) {
|
||||
|
||||
Reference in New Issue
Block a user