mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-13 06:36:26 +03:00
fix: fifth review round (durable mount failures, {#key} hydration slots)
cursor[bot]:
- variant_mount_failed now sets the session's pendingEvent (without
clobbering a still-pending generate), so a helper restart replays it
onto /poll and a repair --reply resolves instead of returning
unknown_poll_reply_id. live-resume's next action names the real event
id instead of a literal EVENT_ID placeholder.
- Contract v2 text hydration strips {#key} DELIMITERS from the zip
source (content stays; it always renders), so key blocks can no longer
shift expression slots against the live DOM.
This work was produced with AI assistance (Claude Code).
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Code
parent
39df25ee5a
commit
e5f6d27a9c
@@ -5501,9 +5501,13 @@
|
||||
}
|
||||
|
||||
// Remove balanced {#each}...{/each} and {#if}...{/if} regions (including
|
||||
// the delimiters) from a markup string. Nesting-aware.
|
||||
// the delimiters) from a markup string. Nesting-aware. {#key} blocks keep
|
||||
// their CONTENT (it always renders) but lose their delimiter tokens, which
|
||||
// would otherwise consume live text slots in the zip and shift every
|
||||
// following expression.
|
||||
function stripSvelteBlockRegions(markup) {
|
||||
let out = String(markup || '');
|
||||
out = stripSvelteKeyDelimiters(out);
|
||||
for (const kind of ['each', 'if']) {
|
||||
const open = '{#' + kind;
|
||||
const close = '{/' + kind + '}';
|
||||
@@ -5530,6 +5534,30 @@
|
||||
return out;
|
||||
}
|
||||
|
||||
function stripSvelteKeyDelimiters(markup) {
|
||||
let out = String(markup || '');
|
||||
for (;;) {
|
||||
const start = out.indexOf('{#key');
|
||||
if (start === -1) break;
|
||||
// The opening tag runs to its matching close brace (expressions inside
|
||||
// may nest braces).
|
||||
let depth = 0;
|
||||
let i = start;
|
||||
let openEnd = -1;
|
||||
while (i < out.length) {
|
||||
if (out[i] === '{') depth++;
|
||||
else if (out[i] === '}') {
|
||||
depth--;
|
||||
if (depth === 0) { openEnd = i + 1; break; }
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (openEnd === -1) break;
|
||||
out = out.slice(0, start) + out.slice(openEnd);
|
||||
}
|
||||
return out.split('{/key}').join('');
|
||||
}
|
||||
|
||||
function cloneWithoutElements(rootEl, excludedEls) {
|
||||
if (!excludedEls || excludedEls.length === 0) return rootEl;
|
||||
const excludedSet = new Set(excludedEls);
|
||||
|
||||
Reference in New Issue
Block a user