Repository navigation
fix: keep the user's place only after a data change's widget paints have drawn - #5665
Merged
Merged
Conversation
…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
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.
The diff refresh test failed because
holdUserPlace's keep ran before the page finished drawing the reading. The fix adds one moreawait whenDocumentPresented()before the keep instate-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: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:
pnpm run test:runtime: 896 passed.tests/journeys/test_page_holds_still.pythat cover data-driven diffs, replies, seats and Page Map: 11 passed, 2 marked xfail.test_agent_replies.py.Firefox cases of the matrix were not run.
Closes #5644 — automated triage