Repository navigation
Drop the Effect UI patch: no view controls a details' open any more - #7545
Merged
Merged
Conversation
`build/@effect__ui.patch` (#7515, #7522) held one guard and nothing else: Effect UI's host skipped writing a `details`' controlled `open` while a `toggle` for it was still queued. It covered only the controlled path, `.open()` or `.prop("open")`, which Effect UI writes on every draw and again in the frame after each `toggle`. Since #7542 no view writes `open` that way. lf-call-diff and lf-toc seed it with an `.attr` the view never changes, and lf-worktree writes an `.attr` from its host's authored `open`. Effect UI writes an attribute only when the view's value differs from the last draw's (`patchAttrs`) and never restores one, so the guard ran for no node. The rebuilt `browser/vendor/effect-ui.js` is byte-identical to the bundle before #7515. The race the patch fixed lives in the controlled idiom itself, which lf-call-diff and lf-toc used before #7542: `.open(model.open)` with a `toggle` handler the Model follows. The browser reports a fold with `toggle` a task after making it. A write in that gap, from a draw a message brings or from the restore an earlier `toggle` queued, undoes the fold, and the browser merges the queued `toggle` into one that reports no change. `value` and `checked` have no such gap, since `input` and `change` fire inside the gesture. Leaf's rule gives a fold to the browser, so the fix was to stop controlling it, as #7542 did, rather than to change the host. effect-widget.ts's list of Effect UI's limits now says that a Model following `toggle` loses the fold too. lf-worktree keeps its binding. Its `open` changes only when a revision changes the host's authored `open`, and the write then lands where the user's press already left the fold or replaces a fold the user never changed. Its fold is also kept per tab through `data-lf-open-key` (prepaint.ts, `keepDisclosure`), which sets `open` through the node, a write a draw of a controlled `.open()` could undo. Evidence, all on the unpatched bundle: - A page with one Effect UI `details`: the controlled idiom lost the press in both races (Chromium: second press 0 of 5 held, press then redraw 0 of 5; Firefox 1 of 5 and 0 of 5). `.attr("open", "")` held 5 of 5 in both, and the patched bundle held 5 of 5 in all four cases. - Leaf's views from before #7542 fail `test_a_second_toggle_before_the_next_frame_holds`, `test_a_fold_redrawn_before_its_toggle_holds` and `test_call_diff_projects_stable_commentable_rows`. The views on main pass them, 12 of 12 copies each under `leaf-dev suite flake --workers 4 --load 2`, as does lf-toc's `test_contents_disclosure_keeps_its_links_focus_and_open_state`. - The lf-call-diff, lf-toc and lf-worktree browser tests (18 and 12 subtests), `pnpm run test:runtime` (1240) and `pnpm run check:browser` pass. The two race tests keep their assertions. Their comments described the patch's write-back of the Model's `open`, and now describe the window each one guards. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Leaf stops patching Effect UI.
build/@effect__ui.patch(#7515, #7522) held one guard: the host skipped writing adetails' controlledopenwhile the user'stogglefor it was still queued. Since #7542 no view controlsopen.lf-call-diffandlf-tocseed it with an attribute the view never changes, andlf-worktreewrites an attribute only when its host's authoredopenchanges. Effect UI writes an attribute only when the drawn value changes and never restores one, so the guard ran for no node. The rebuiltbrowser/vendor/effect-ui.jsis byte-identical to the bundle before #7515.The race lives in the controlled idiom itself. The browser reports a fold with
togglea task after making it, and a draw or restore in that gap undoes the fold, even where the Model followstoggle. So a widget leaves a fold to the browser, andeffect-widget.ts's list of Effect UI's limits now says why.Max asked to avoid the patch ("it's much more likely we misunderstood something rather than the upstream needs patching"). The two race tests from #7515 and #7522 keep their assertions and pass on the unpatched bundle, 12 of 12 copies each under load; with the views from before #7542 put back, they fail. The
lf-call-diff,lf-tocandlf-worktreebrowser tests,pnpm run test:runtime(1240) andpnpm run check:browserpass.