Fix scroll jump when loading older messages#1035
Open
tlongwell-block wants to merge 1 commit into
Open
Conversation
86d47bc to
80d0185
Compare
Co-authored-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co> Signed-off-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co>
80d0185 to
b718e7a
Compare
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.
Summary
until/limitand support delayed history responsesRoot cause
useLoadOlderOnScrollcaptured bothscrollHeightandscrollTopbeforefetchOlder(). After older history returned, it restored topreviousScrollTop + delta. If the user scrolled while the history request was in flight, that later restore wrote from stalepreviousScrollTopand discarded the user's newer scroll position.The fix keeps the existing scrollHeight-delta algorithm, but applies the delta to the current DOM
container.scrollTopafter the prepend commits.Test plan
bin/pnpm --dir desktop buildbin/pnpm --dir desktop exec playwright test tests/e2e/scroll-history.spec.ts --project=smokebin/pnpm --dir desktop exec playwright test tests/e2e/video-attachment.spec.ts --project=smoke(rerun of unrelated smoke flake; passed standalone)bin/pnpm --dir desktop check(passes with existing onboarding unused-variable warnings)Notes:
bin/pnpm --dir desktop test:e2e:smokereached193 passed;video-attachment.spec.tsfailed once, then passed standalone.rust-clippybecause the localrustc 1.89.0is below dependency requirements (irohneeds 1.91,sqlxneeds 1.94). I pushed with--no-verifyafter the targeted desktop verification above.