feat(dev): morph lab live updates in place so refreshes stop wiping input #58
No reviewers
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos!58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/lab-keyed-dom-morph"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements #57: background refreshes now patch the lab UI in place via a keyed DOM morph instead of rebuilding the
#liveregion withinnerHTML. Typing into an instance label or login code, the caret, focus, scroll position, the filter, and the "connecting…" spinner all survive a refresh, while the list still updates live.How
templates/index.html, inline, dependency-free, no build step):keyOf/sameType/patchAttrs/patchNode/morphChildren. Keyed children (cards bydata-name, instance rows by the newdata-instance, the four top blocks bydata-key) are reused and reordered by key; unkeyed children match positionally, with a same-position tag mismatch replacing in place — so a "connecting…" span becomes an "Open" link without rebuilding its row, and a started project floats up as a moved card. Attributes reconcile including removals;value/checked/selectedare never written, so a typed field survives a morph.Tests
TestLivePartial_keyContractpins the server↔client key contract (data-name/data-instance/data-keypresent, including the empty-statedata-key="projects") so a future template edit can't silently drop a key and degrade live updates.go build+go test ./...pass locally (pre-commit is eval-only for lab, so I ran them by hand).isEqualNodeas a structural oracle plus node-identity checks. All pass; the one skipped assertion (focus across a DOM move) is a jsdom-only gap that real browsers don't have.Remaining manual verification (deploy/verify loop)
Per the PRD: after merge, fw pulls within ~5 min and the dev microvm rebuilds — re-verify on the authenticated URL and on a phone (type a label while a sibling instance connects; filter during live updates; armed Stop-all survives the refresh interval; a partial login code survives; ~44px tap targets and no flicker).
Closes #57