Skip to content

fix: keep the user's place only after a data change's widget paints have drawn - #5665

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5644
Nov 7, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5644

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The diff refresh test failed because holdUserPlace's keep ran before the page finished drawing the reading. The fix adds one more await whenDocumentPresented() before the keep in state-application.js. With it, test_a_diff_refresh_leaves_an_inline_reply_to_its_thread_owner[False-True] passes again, with its assertion unchanged. It had failed on main since #5396.

Cause. The keep ran as soon as notifyDataSubscribers() returned. That call waits only for the regions the data joins, here the diff. In this case the new patch is rename-only, so the commented line is gone, and the diff's own paint claims another thread pass. That pass parks the reply and opens its margin card, and it ran after the keep:

  1. The keep read the reply at a temporary spot in the file's thread outlet, 41 px above where it stood.
  2. It scrolled the page 41 px to put the reply back.
  3. The margin card then drew the reply somewhere else (353 px vs 530 px on screen).

So the 41 px scroll kept neither the page nor the field. The test's expected scroll (page unmoved) is the right reading. holdUserPlace's header already says the keep runs once the page shows the reading, "every renderer and the data its widgets read included". The code now does that.

With the fix, the keep reads the reply after it has landed in its margin card. The card's own landing places it, and the page stays where it was. Marking the state applied also waits for those extra paints now, since it follows the same await.

Checks run locally:

  • Both cases of the failing test.
  • pnpm run test:runtime: 896 passed.
  • The Chromium cases of tests/journeys/test_page_holds_still.py that cover data-driven diffs, replies, seats and Page Map: 11 passed, 2 marked xfail.
  • The diff refresh and redraw tests, and the hold tests in test_agent_replies.py.

Firefox cases of the matrix were not run.

Closes #5644 — automated triage

…ave drawn

`holdUserPlace`'s keep ran as soon as `notifyDataSubscribers` returned, which waits
only for the regions the data joined. A diff whose new patch drops a commented line
claims a thread pass from that paint, and the pass parks the reply and opens its
margin card after the keep. The keep read the reply at its passing spot in the
diff's file outlet, 41 px above where it stood, scrolled the page by 41 px to put it
back, and the card then drew the reply elsewhere, so it kept neither the page nor the
field. The keep now waits for `whenDocumentPresented` again, so it reads the page
the reading finally shows, as `holdUserPlace`'s contract already says. The state is
marked applied after the same wait.

`test_a_diff_refresh_leaves_an_inline_reply_to_its_thread_owner[False-True]`, red on
main since #5396, passes again; its assertion is unchanged.

Closes #5644
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.

test_a_diff_refresh_leaves_an_inline_reply_to_its_thread_owner[False-True] fails on main since #5396's one place hold

1 participant