Skip to content

Build Effect UI for production, and settle when its widgets' Commands and member sets draw - #7434

Merged
max-sixty merged 4 commits into
mainfrom
review-effect-ui
Nov 27, 2026
Merged

max-sixty merged 4 commits into
mainfrom
review-effect-ui

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Four fixes to the Effect UI adapter's foundations, found while reviewing the Effect UI work.

  • Production build. build/vendor.mjs set no production condition, so @effect/ui's #dev and #hot imports resolved to its development builds: every page with an Effect UI widget shipped the hot-reload and devtools code, and each mount read sessionStorage and scanned every live root. The row now builds with conditions: ["production"]. /vendor/effect-ui.js drops from 595,034 to 580,769 bytes (196,227 to 190,967 gzipped), with Scheduler added to its exports.
  • Scheduler. A gesture's Command ran in the gesture's task only because the scheduler Effect.runSync creates for each mount stays in the root's context, which keeps Effect UI from installing its time-sliced HtmlScheduler. Mounted with runFork, a probe's Command ran eleven tasks later behind 50 ms of other roots' work. defineWidget now provides a synchronous MixedScheduler itself, so the timing is the adapter's choice (BrowserHost.mountEffect's docs name this as supported).
  • Members. A member set before the element connected was dropped, and one set before the tag was defined left an own property hiding the accessor, so a page that set lf-motion's currentTime before the study connected lost the seek. The adapter now holds the message for the next root, as it already kept early properties. A member set also announced no pending-task or lf-commands for the redraw it causes; it now draws the way a set of props does. On a shadow widget, lf-commands still leaves from the shadow root, where Leaf ignores it; Port lf-options to Effect UI as the first decorating widget #7417 moves it onto the element, so this leaves that line alone.
  • lf-motion's entry promised that a seek draws its frame synchronously, which the widget's port (Draw lf-motion as an Effect UI component #7397) stopped doing. Nothing that seeks relies on it, so the entry now says the widget draws the latest time's frame before the next frame.

Nothing a user sees changes. #7417 also edits effect-widget.js, in other lines.

Tests: pnpm run test:runtime (1,201 pass; the two new member tests fail without the fix), pnpm run check:browser, and the tally (test_a_tally_counts_its_regions_obligations_and_walks_them), timeline and motion browser and journey tests. Codex reviewed each commit; its findings are folded in.

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

The vendored Effect UI bundle resolved its `#dev` and `#hot` imports to the
development builds, since `build/vendor.mjs` set no `production` condition,
so every page with an Effect UI widget shipped the hot-reload and devtools code,
and each mount read `sessionStorage` and scanned every live root. The row now
builds with `conditions: ["production"]`: `/vendor/effect-ui.js` goes from
595,034 to 580,769 bytes (196,227 to 190,967 gzipped) with `Scheduler` added
to its exports.

A Command a gesture issues ran in the gesture's task only because the adapter
mounts with `Effect.runSync`, whose private synchronous scheduler stays in each
root's context and keeps Effect UI from installing its time-sliced
HtmlScheduler. A probe mounting the same root with `runFork` ran the Command
eleven tasks later behind 50 ms of other roots' work, past the next frame.
`defineWidget` now provides `Scheduler.Scheduler` itself, a synchronous
`MixedScheduler` that runs on microtasks of the asking task, so the timing is
the adapter's choice. Behaviour is unchanged: the runtime tests (1,199) and the
tally, timeline and motion browser tests pass.
leaf-agent
leaf-agent previously approved these changes Nov 27, 2026
`defineWidget`'s member setter sent its message to the root only when one stood,
so a set before the element connected was dropped, and a set before the tag was
defined left an own property hiding the accessor. On `lf-motion`, a page that set
`currentTime` before the study connected lost the seek. The adapter now holds a
member's message while no root stands and sends it to the next root, and moves a
member's pre-upgrade own value through its accessor, as it already did for
`properties`. Two runtime tests fail without the change and pass with it.
@max-sixty max-sixty changed the title Build Effect UI for production, and give its widgets their scheduler Build Effect UI for production, give its widgets their scheduler, and keep early member sets Nov 27, 2026
leaf-agent
leaf-agent previously approved these changes Nov 27, 2026
… a frame

A member set sent its message to the root, whose redraw lands in Effect UI's
next flush, but announced no `pending-task` and no `lf-commands` after it, and
a set held for a root's mount announced `lf-commands` before the held value had
drawn. A member set now goes the way a set of props does: the drawing settles a
`pending-task`, and `lf-commands` follows it. The runtime test of a held set
checks what the host sees when `lf-commands` fires.

`lf-motion`'s registry entry told authors that assigning `renderFrame` draws
the current frame at once and that every seek calls it synchronously. Since the
widget moved to Effect UI (#7397) it draws a microtask later, before the next
frame, which nothing that seeks relies on; the entry now says that.
@max-sixty max-sixty changed the title Build Effect UI for production, give its widgets their scheduler, and keep early member sets Build Effect UI for production, and settle when its widgets' Commands and member sets draw Nov 27, 2026
Two seeks in one task draw only the second time's frame, since the widget draws
in Effect UI's next flush, so the entry now says the widget draws the latest
time's frame before the next frame after an assignment, a seek or a playback
step.
@max-sixty
max-sixty merged commit a2a7fef into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the review-effect-ui branch November 27, 2026 20:45
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