Skip to content

refactor: simplify Solid widget lifecycles and DOM ownership - #176377

Merged
steipete merged 2 commits into
mainfrom
solid2/w-zero-widgets
Oct 18, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-zero-widgets

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Solid widget shells still contain redundant lifecycle effects, reactive tracking suppression, and DOM searches for elements whose owners already know them.

User Impact

No intended visual change. Existing host tags, classes, selectors, routes, lazy imports, iframe retirement acknowledgements, terminal focus, and remote input behavior are preserved. Remote desktop callbacks now retire after permanent disconnect, including with noVNC’s custom event target, which ignores AbortSignal listener options.

Why This Change Was Made

Use owner-scoped listener cleanup, plain arguments for retained services, refs for board/MCP/lobster elements, and derived terminal trigger selection. Custodian refresh follows the visible component's lifetime; preview commits follow their update handler; lobster animation timers start at the synchronous owner's reconciliation. A small Tabs ref interface exposes its existing tab registry to board scrolling. noVNC cleanup uses actual removal callbacks rather than unsupported listener options, with a regression fixture matching its installed EventTargetMixin contract. MCP activity retains one deliberate initial snapshot because activity and visibility must publish atomically.

This is the first widget cleanup batch, not a claim that the wave-zero targets are complete. It removes all direct DOM listeners from the Solid shells and 24 of 25 scoped untrack calls. The remaining effects synchronize existing external owners. Reaching the 70% effect target needs shared commit/measurement primitives or changes to those owners; wrapping the same work in local helpers would only hide it. Four composer geometry searches and assistant foreground-pane discovery require owner interfaces in the chat/composer lane.

Evidence

Check Result
pnpm tsgo:ui Pass after correcting the cell readiness interface and Solid Show signatures
Three focused files, one run each, --maxWorkers=1 93 tests pass: MCP cell lifecycle, hosted terminal tabs, lobster lifecycle (12.73 s); the added noVNC disconnect regression stays in CI under the three-file local budget
Targeted lint; formatting; git diff --check Pass; style-string/native-listener warnings remain; focused tests also emit STRICT_READ_UNTRACKED diagnostics, with remaining tracking cleanup explicitly unfinished
Independent review Both initial refactor and incremental noVNC correction: P0–P2 scoped clean
Production Knip Same two unused reply-admission files on both base and final 85fc54e83789 head: reply-admission-ticket.ts, reply-turn-admission-owner.ts; no widget findings
Same-machine base/head production builds and strict performance comparison Pass: startup JS 336,506 → 336,511 B gzip (+5 B), identical 1,019,449 B raw; 7 JS requests and 1 CSS request on both sides. Chat/new boot +56/+70 B, requests unchanged. Measured at c7d32eea66f; the subsequent correction changes only the existing isolated desktop runtime
Broad UI, performance/retention, browser, real-Gateway proof ci:full; PR CI owns broad proof

No rendered markup or stylesheet changes are intended, so this refactor makes no visual-change or screenshot claim. No local E2E or full test suite ran, and no remote testing lease was requested.

Refactor measurements

Against 6fcf1c433273aa44c0663c09a4c0432bc5567ece; production widget scope excludes tests and test helpers. Query totals include generic TypeScript calls that the checklist's literal regex misses.

Pattern Before After
Rendering controller patterns 0 0
createEffect 31 24
createRenderEffect 0 0
untrack 25 1
addEventListener references, including Gateway API declaration/calls 46 10
querySelector(All) (literal checklist regex) 13 8
Queries including typed calls 28 18
Changed production LOC, 39 files including the coupled Tabs interface 10,717 10,786
Test LOC change 0 +22

The 69-line production growth is principally explicit paired listener disposal and element-ref ownership. No dependency, configuration option, controller, or alternative renderer is introduced.

Remaining effects and queries

Effects: board document binding (board/board-document.tsx:313), MCP retirement (board/board-mcp-app-content.tsx:33), tab scroll measurement (board/board-tabs.tsx:37), board readiness (board/board-view.tsx:172), widget frame/loading/error owners (board/board-widget-cell.solid.tsx:214,241,266); browser/terminal commit receipts (browser/browser-panel-registration.tsx:84, terminal/terminal-panel-registration.tsx:100); desktop transport authority/subscription (desktop/desktop-panel-solid.tsx:70,81); assistant dock reconciliation/subscriptions (assistant-panel-solid.tsx:46,66); MCP iframe binding/title/presentation/geometry (mcp-app-view.tsx:54,57,67,68); canvas authorization/sandbox (canvas-widget-view.tsx:649,663); link-reader intersection/markdown/owner binding/commit work (link-reader-content.tsx:362, link-reader-markdown.tsx:194, link-reader-panel.tsx:176,207); lobster owner props (lobster-pet.tsx:27). The shared intersection primitive is still in the primitives lane.

The scoped untrack survivor is board/board-mcp-app-lifecycle.ts:52, the intentional initialActive snapshot. The coupled Tabs file retains its unchanged keyed-value lifetime snapshot (solid/tabs.tsx:69). Remaining listener references belong to WebSocket, AbortSignal, AudioBufferSourceNode, or the Gateway event API, with abort scopes or paired removal.

Foreign-island queries: remote favicon document (browser/browser-favicon-script.ts:7,13), noVNC (desktop/desktop-client.ts:20), markdown output (link-reader-hovercard-owner.ts:188, link-reader-markdown.tsx:216,227,231, link-reader-panel-owner.ts:278, link-reader-prefetch-owner.ts:194), inert SVG export (lobster-image.ts:62,68,69). Remaining scoped work: MCP host discovery across render roots (mcp-app-unmount.ts:20) needs lifecycle registration; it is not an iframe-internal query. Cross-lane work still required: authoritative foreground pane lookup (assistant-panel-controller.ts:173) and composer geometry refs (lobster-pet-scene.ts:261,262,266,272).

Exact-head CI attribution

Final head 85fc54e83789 ran ci:full run 39162184776. All non-skipped jobs passed except the two real-Gateway jobs and their aggregate gate. security-fast passed. The added noVNC regression is covered by the passing full UI unit job. All three failed test names and assertion signatures also fail in latest completed scheduled main run 39158806323:

Failed test Matching main failure
chat-managed-media-order: keeps headings, managed images and trailing prose ordered live and after reload without duplicates Expected six ordered items, received four; missing image items
chat-tts-supplement: attaches delayed speech to each original answer live and after reload Expected one speech supplement, received zero
control-ui-media-transcript: delivers PowerPoint and keeps persisted attachment failures replay-safe 30-second wait for the slides.pptx attachment card

Landing uses the authorized native inherited-failure route with retained exact-head checkout and annotation evidence; these CI failures remain failures.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T20:14:48.644850Z 85fc54e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete merged commit 26e2445 into main Oct 18, 2026
100 of 104 checks passed
@steipete
steipete deleted the solid2/w-zero-widgets branch October 18, 2026 20:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…w#176377)

* refactor: simplify Solid widget lifecycles and DOM ownership

* fix: retire noVNC listeners with explicit teardown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant