Tell the host when the version notice goes away with the element

The controller dropped its banner on disconnect without asking the host
to repaint. Lit renders neither on disconnect nor on reconnect, so the
markup produced before the detach outlived it: the notice stayed on
screen while the controller no longer owned one, and it left only when
some unrelated update happened to run. Correctness rested on a
coincidence.

Measured on the built module with a counter: the sequence mismatch ->
disconnect -> versions agree -> connect asked for exactly one repaint,
the one that showed the notice. It now asks for two, and the second is
the one that takes the notice away.

Nothing else about the teardown changes. The field is still cleared
because a detached element cannot deliver animationend, reconnect still
rebuilds the notice from the retained input, and a disconnect with no
notice still asks for nothing.

Issue: #536
User-Visible: no
This commit is contained in:
Claude
2026-09-12 03:49:46 +00:00
committed by claude[bot]
parent 4906f0a97f
commit 1e1880f010
50 changed files with 491 additions and 425 deletions
+16
View File
@@ -2412,6 +2412,22 @@ const MUTANT_DEFINITIONS = [
replace: '',
}],
},
{
id: 'version-banner-disconnect-silent',
guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '
+ '&& node --test --test-name-pattern="#536 a notice dropped" test/version-recovery.test.mjs',
because: 'Lit renders neither on disconnect nor on reconnect, so a notice dropped in silence '
+ 'stays on screen with no owner until some unrelated update happens to run — correctness '
+ 'by coincidence, which is exactly what #536 removed',
patches: [{
file: 'src/version-recovery.ts',
find: ' if (this._banner) {\n'
+ ' this._banner = null;\n'
+ ' this.hooks.changed();\n'
+ ' }',
replace: ' if (this._banner) this._banner = null;',
}],
},
{
id: 'align-guides-exclude-dead-source',
guard: 'node demo/smoke_align_guides.mjs',