Skip to content

Delete the controller and watchData paint routes LeafElement replaced - #2919

Merged
max-sixty merged 3 commits into
mainfrom
selection-keyed-repaint
Oct 15, 2026
Merged

max-sixty merged 3 commits into
mainfrom
selection-keyed-repaint

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Deletes the widget paint routes LeafElement replaced: the controller's subscribe and the renderState it called, and watchData. Every widget draws as a LeafElement since #2912, so this leaves one way for a widget to draw what it reads.

Runtime

  • widget-controller.js keeps read, dispatch, defer and present. Its subscriptions, total render, render region and readingPaint route go. defer() holds a LeafElement's drawing and refuses any other owner; an ancestor's remount refreshes the LeafElements around it.
  • data.js loses watchData and its per-subscription presentation; the data version waits on the regions LeafElements join (joinDataDelivery).
  • The render check's replay (render-checks/replay.js) replays through redraw() alone, and its findings name render().
  • leaf package new scaffolds a widget as a LeafElement.
  • LeafElement puts its fail-soft box after what it drew, so nothing it drew moves for the box, and keeps the box when the same failure repeats. A drawing() that rejects reports a failure naming the widget. A widget that leaves while a drawing() is unfinished draws again on return, as a watchData subscriber whose paint was cut short did; before this, the return stamped its region and data version with the drawing still pending.

Docs

module-state.md and module-authoring.md teach LeafElement as the way a widget draws: this.state, this.data(input), drawing(), updated(). The Upgrade and connection recipes build a widget in setup() and keep once() for other custom elements. Registry descriptions and the event-log page say render() and this.data where they said renderState and watchData.

Tests

The runtime tests of watchData move to LeafElement widgets where they protect behaviour a widget still has (its own binding, a superseded asynchronous draw not stamping the newer data version, an unchanged source waiting for its drawing, an asynchronous projection keeping its captured provenance); the ones about watchData's own lifecycle go. A new runtime test holds the unfinished-drawing return (it failed before the fix, drawing once instead of twice). A browser test holds the first state read and checks that a widget's reading is already its whole authored state, so LeafElement's incomplete-reading gate does not hold it at startup (the header had named startup as that gate's case; it is a revision's replacement before its document is adopted). The browser tests' inline widgets draw as LeafElements. The widget-controller-lifetime eval's first two rubrics judge LeafElement render reads in place of subscribe and watchData.

TODO.md's TC39 signals item records the assessment now that there is one class: adopting Lit's SignalWatcher would save about fifteen lines of #follow but has no hook for claiming the widget's region, and the projection and version paints still read Preact signals, so it waits on a new trigger.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 3 commits October 14, 2026 17:42
Every widget draws as a LeafElement since #2912, so the widget controller's
subscribe/renderState route and data.js's watchData go, leaving one way for a
widget to draw what it reads. The controller keeps read, dispatch, defer (for a
LeafElement) and present; the render check replays through redraw(); the package
starter scaffolds a LeafElement; module-state.md and module-authoring.md teach it,
building in setup().

LeafElement's fail-soft box now stands after what it drew and stays for a repeated
failure, a rejected drawing() names the widget, and a widget that leaves while its
last drawing() is unfinished draws again on return (behaviour the deleted
watchData return test protected; a runtime test holds it now). The
widget-controller-lifetime eval judges LeafElement render reads. TODO.md records
the TC39 signals assessment.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Before the first state read answers, a widget's reading is its authored state with
every declared verb, so LeafElement's incomplete-reading gate does not hold it at
startup; the header named startup as the gate's case, and now names a revision's
replacement before its document is adopted.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 2fc25ad into main Oct 15, 2026
2 of 3 checks passed
@max-sixty
max-sixty deleted the selection-keyed-repaint branch October 15, 2026 01:05
leaf-agent added a commit that referenced this pull request Oct 15, 2026
Remove the exact JavaScript template assertion from the `package init`
journey. The starter changed in #2919, and the scheduled test failed on
its source text even though the generated widget remained usable. The
journey still checks the generated registry and package, vendors the
module into a page, and passes `page check --render`.

Verified locally: `uv run pytest
tests/journeys/test_interact_layer.py::test_package_init_starts_one_checked_upgraded_widget
-q -n0` (1 passed).

---------

Co-authored-by: leaf-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants