Repository navigation
fix: keep a details where the user's press left it when Effect UI redraws before its toggle - #7522
Merged
Merged
Conversation
…raws before its toggle Effect UI writes a `details`' controlled `open` from two paths: the restore a frame after a `toggle`, and the render each message brings. #7515's patch (`build/@effect__ui.patch`) taught only the restore to wait while a press's `toggle` is still queued. A render landing in that gap still wrote the Model's older `open` back, undid the press, and the browser merged the queued event into one reporting no change, so the Model never heard of it. In `test_call_diff_projects_stable_commentable_rows` that is a fold of the call tree's root followed by Enter on the root's location before the fold's `toggle` arrives: the location's message redraws the tree and reopens the root. The patch now sends both paths through one guard, `writeOpen`, which skips a `details` whose `open` differs from the state the host last knew for it, and records each value the host writes or finds, so a node's first press is covered too. `test_a_fold_redrawn_before_its_toggle_holds` folds a root and presses its location in one task, so the redraw comes before the `toggle`. It failed 2 of 2 on main's bundle (the `toggle` reported `open`) and passes with the patch. The bundle from before #7515 fails the same forced ordering, so the race predates #7515; #7515 only left the render path unguarded. `test_call_diff_projects_stable_commentable_rows` passed 24 of 24 under `leaf-dev suite flake --load 2`, the call-diff, toc and toggle tests in `test_render_diff_controls.py`, `test_render_toc_disclosure.py` pass (24), `pnpm run test:runtime` passes (1237) and `pnpm run check:browser` reproduces the committed bundle. Closes #7521
max-sixty
added a commit
that referenced
this pull request
Nov 28, 2026
…7545) Leaf stops patching Effect UI. `build/@effect__ui.patch` (#7515, #7522) held one guard: the host skipped writing a `details`' controlled `open` while the user's `toggle` for it was still queued. Since #7542 no view controls `open`. `lf-call-diff` and `lf-toc` seed it with an attribute the view never changes, and `lf-worktree` writes an attribute only when its host's authored `open` changes. Effect UI writes an attribute only when the drawn value changes 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 lives in the controlled idiom itself. The browser reports a fold with `toggle` a task after making it, and a draw or restore in that gap undoes the fold, even where the Model follows `toggle`. So a widget leaves a fold to the browser, and `effect-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-toc` and `lf-worktree` browser tests, `pnpm run test:runtime` (1240) and `pnpm run check:browser` pass. > _This was written by Claude Code on behalf of max-sixty_
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.
Effect UI writes a
details' controlledopenfrom two paths: the restore one frame after atoggle, and the render each message brings. #7515's patch (build/@effect__ui.patch) taught only the restore to wait while a press'stoggleis still queued. A render in that gap still writes the Model's olderopenback. That undoes the press, and the browser merges the queued event into one reporting no change, so the Model never hears of the press. Intest_call_diff_projects_stable_commentable_rows, the test folds the call tree's root and presses Enter on the root's location. When the Enter lands before the fold'stoggle, the location's message redraws the tree and reopens the root. That is #7521's failure.The patch now sends both paths through one guard,
writeOpen. It skips adetailswhoseopendiffers from the state the host last knew for it. It also records each value the host writes or finds, so a node's first press is covered too. A Model that refuses a press still gets its value written back by the restore that the press'stogglebrings. Dialogs and popovers take their own branches and are untouched. The only rebuilt bundle isbrowser/vendor/effect-ui.js.Verification. The new test
test_a_fold_redrawn_before_its_toggle_holdsfolds a root and presses its location in one task, which forces the redraw ahead of thetoggle. It failed 2 of 2 on main's bundle, where thetogglereportedopen, and it passes with the patch. The bundle from before #7515 fails the same forced ordering, so the race predates #7515, and #7515 left the render path unguarded.Other checks run
test_call_diff_projects_stable_commentable_rows: 24 of 24 underleaf-dev suite flake --workers 4 --load 2. Before the fix it failed about 1 in 25 locally, on Chromium, and the failure matched CI's capture: the patch line was focused and the root was open.test_render_toc_disclosure.pytogether with the call-diff, toc, toggle and fold tests intest_render_diff_controls.py: 24 passed.pnpm run test:runtime: 1237 passed.pnpm run check:browserreproduces the committed bundle from the updated lock.Closes #7521 — automated triage