State inside a closed branch
A closed :if branch lives in a <template>, and querySelectorAll does not look inside one. Anything declared in there was therefore never hydrated: it started undefined, ignored its persist token, and stayed that way for the life of the page. Now the runtime re-claims seed scripts whenever a render changes structure, so a branch that opens brings its declarations with it.
Open the panel
The :state retries line above lives inside this branch. Before this change it was never declared at all: the counter below read empty and nothing was ever written to storage.
Retries: 3
Change it, close the panel, reopen it: the value you set is still there, because re-opening a branch does not re-seed a key state already holds. Reload the page and it is still there too, because persist now works from in here.
The panel is closed. Everything inside it, including its :state, is still in a <template>.
The panel is closed. Everything inside it, including its :state, is still in a <template>.
The rules
- A seed is claimed once per key, not per node. Re-opening a branch clones fresh
<script>nodes, so a per-node claim would have reset the reader's value every time. - The seed recorded when the key is claimed is also its
resetbaseline, so a late declaration is resettable like any other. persistand:storeread through storage at claim time, so a durable value declared in a branch comes back the first time the branch opens.