Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initial pager gap after fast scroll #1868

Merged
merged 1 commit into from
Nov 10, 2023
Merged

Fix initial pager gap after fast scroll #1868

merged 1 commit into from
Nov 10, 2023

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Nov 10, 2023

This fixes a bug in the new pager sync scrolling logic I've added in #1863.

The previous code was saying: "sync scroll only if we didn't scroll past the header". The problem is that if we scroll fast, we're gonna have a large gap between the last event (which didn't reach the limit, but got synced) and the next event (which went over the limit, and didn't get synced).

Instead, let's track the last value that got synced. During every scroll, we'll calculate the new target, applying the limit. If we need to sync up the scroll, we'll do so and store the current value as the last one that got synced.

As a result, if we get an event that "overshoots" the header hiding threshold, we'll still adjust other pages to be exactly at that limit.

Test Plan

Flicking one of the tabs down really fast no longer causes a blank space on other tabs.

@gaearon gaearon requested a review from pfrazee November 10, 2023 21:20
Copy link
Collaborator

@pfrazee pfrazee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@gaearon gaearon merged commit 86b4842 into main Nov 10, 2023
4 checks passed
@gaearon gaearon deleted the fix-pager-gap branch November 10, 2023 21:23
estrattonbailey added a commit that referenced this pull request Nov 11, 2023
* origin:
  Refactor feeds to use react-query (#1862)
  Use min height for pager lists and increase it (#1869)
  Fix initial pager gap after fast scroll (#1868)
  Scroll sync in the pager without jumps (#1863)
  Push useAnimatedScrollHandler down everywhere to work around bugs (#1866)
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.

2 participants