Repository navigation
fix: start the panel's writing posture in the paint that puts the caret in the page comment - #5335
Merged
Merged
Conversation
…e page field Opening the page's comment from an open panel view (`c` on an empty Threads list, or the panel's own `c`) cleared the view and painted the row with `writing` still false, so the quick control showed, then focused the field, whose focus set `writing` and hid the control again in the same task: the write watch's `unchanged write: hidden on div.lf-fp-quick`. The paint that lands the caret now starts the posture before it renders, so the row draws it once. Refs #4745
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
Pressing a row in the leaf's menu puts the menu away, which paints the empty row, and then runs the row's command, which may paint again. When `z` shows a resolved thread in the panel, the first paint showed the On Me mark and the second hid it, in one task, so the write watch failed `test_z_names_what_it_takes_and_how_long_ago_in_a_fresh_tab` on every main and nightly run. With a page draft in the field, `data-lf-drafted` flipped the same way. `putAwayThen` now holds the row's posture while the press runs: the parts of the row that follow the field and the view over it (the host's writing, draft, offer and press attributes, the leaf's dots and count, and the quick seat). It then paints once, so each is written once per press. The Fold row's bypass from #5263, which avoided the same paint flipping the leaf's error dot, is removed, and Fold goes through `putAwayThen` like every other row. **Why not one transition, as the issue proposed.** I tried deferring the put-away's paint into the command's own transition. The command then ran with the menu still drawn: Align from the menu on touch left the page unscrolled (`test_the_menu_keeps_its_place_when_a_revision_shortens_the_words_it_held`), and two other menu tests gained new unchanged-write findings. Commands need the panel the put-away drew, so only the posture waits. #4760 and #5335 fixed a different cause, a focus move after a paint changing the writing posture, and those fixes stand. **What it leaves.** The hold ends when the command returns. A view a command opens after an `await`, as Undo does for a resolved thread anchored below the fold, still repaints the posture, as on main; the watch doesn't report that case, since the two writes reach it in separate batches. Pressing Search page from the menu's search still hides and re-shows the field's editors, search surface and mode chip in one press, on main as here: the field's occupant goes search, page editor, search, and the command needs that search drawn, so the hold leaves it. **Checks.** `leaf-dev probe --base`, sampling each frame for 800 ms after pressing Undo, Undo over a page draft, Fold with an error pending, and Copy link, shows the same frames on base and head; base writes the quick seat's `hidden` twice in the Undo press and `data-lf-drafted` twice in the draft case, head neither. The failing test, the Fold test (which fails with the old `putAwayThen` and no bypass) and 29 other focused tests on `putAwayThen`'s callers pass, as does `pnpm run check`. Closes #4745 > _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.
Opening the page's comment from an open panel view —
con an empty Threads list, or the panel's ownc— drew the row twice in one task.writeOnPageclears the view and paints withwritingstill false, so the quick control showed; the same paint then focused the field, andonCurrentLocationsetwritingand hid the control again. The write watch reports that asunchanged write: hidden on div.lf-fp-quick. The paint that lands the caret in the page field now starts the writing posture before it renders, so the row draws that posture once. The refused-send path that setscaretToFieldgets the same single paint.test_c_comments_and_g_t_navigates_to_threadsandtest_the_panels_own_c_answers_a_page_whose_log_has_not_arrivedfail with that finding on main (dc27bd09e, and in push run 41782631970) and pass with this change. Locally, 74 other focused comment/draft/panel browser tests,pnpm run check:browserand the 777 runtime tests also pass. Twotest_commentingfailures in that selection (test_touch_return_keeps_newlines_until_the_user_taps_submit,test_submit_shortcuts_activate_the_controls_that_promise_the_action) fail the same way on main without this change.What this leaves for #4745
test_z_names_what_it_takes_and_how_long_ago_in_a_fresh_tabreports the same finding through a different path. Its first press on the menu's Undo row goes throughputAwayThen:close()paints the empty row (quick control shown), and then the undo command shows the out-of-view resolved thread in a panel view (quick control hidden). Both paints happen in the click's task. Fixing that means the menu's put-away and the command's view have to draw as one transition, which changes howputAwayThenorders focus and painting. That is a separate change from this one.Refs #4745 — automated triage