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

omnibus: scroller perf, devex enhancements #1197

Merged
merged 12 commits into from
Nov 21, 2022

Conversation

tomholford
Copy link
Contributor

@tomholford tomholford commented Nov 18, 2022

Context

This addresses #1187. It also includes additional performance enhancements and devex tweaks.

Changes

  • consistent localStorage key for prerelease banner
  • reuse firstUnread hook
  • virtual scroller performance enhancements
  • remove channel prefetching; use last.brief to sort by recent instead
  • upgrade react-virtuoso from 2.19.0 --> 3.1.4 to fix a scroller bug on iOS Chrome
  • refactor scrollTo to fix #1200

This hook was originally extracted from the Unread banner and then reused in the Scroller; now pulling it back in to the Banner
This changes the localStorage key used to persist the banner notification dimissal to be consistent with the rest of the values we track.
@vercel
Copy link

vercel bot commented Nov 18, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
chatstead ✅ Ready (Inspect) Visit Preview Nov 21, 2022 at 9:37PM (UTC)
homestead ✅ Ready (Inspect) Visit Preview Nov 21, 2022 at 9:37PM (UTC)
homestead-storybook ✅ Ready (Inspect) Visit Preview Nov 21, 2022 at 9:37PM (UTC)

First, prioritize the most recently viewed channel; then batch fetch the remaining channels.

Also, consolidate recentChannel tracking into a hook.
@vercel vercel bot temporarily deployed to Preview – homestead November 18, 2022 08:58 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead-storybook November 18, 2022 09:00 Inactive
@vercel vercel bot temporarily deployed to Preview – chatstead November 18, 2022 09:01 Inactive
Since we pre-fetch all messages from all channels, this change decreases the initial page fetch size to reduce load on the backend, and to render the page sooner.

Then for future page fetches, it uses a much higher number, to reduce subsequent fetches as the user backscrolls.

In a future commit, we will hook into the virtuoso scroll seek configuration; if the user is scrolling above a certain threshold velocity, we will fetch even more messages in anticipation of them going deep in the backscroll.
@vercel vercel bot temporarily deployed to Preview – homestead-storybook November 18, 2022 14:19 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead November 18, 2022 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – chatstead November 18, 2022 14:21 Inactive
@tomholford tomholford changed the title [wip] omnibus: scroller perf, devex enhancements omnibus: scroller perf, devex enhancements Nov 18, 2022
@tomholford tomholford marked this pull request as ready for review November 18, 2022 16:46
Copy link
Member

@patosullivan patosullivan left a comment

Choose a reason for hiding this comment

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

Looks good and runs well locally.

await fetchChannel(recentChannel);
}

// defer the rest, in batches
Copy link
Member

Choose a reason for hiding this comment

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

Thank you!

Copy link
Member

@arthyn arthyn left a comment

Choose a reason for hiding this comment

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

Testing this is giving me some really bad behavior just putting this here now before I can write it all out

@arthyn
Copy link
Member

arthyn commented Nov 18, 2022

So I haven't been able to capture this on camera, but in either watercooler or urbit app dev, on a fresh reload, if you scroll up as soon as you see messages and then scroll up again once the second set of messages load, sometimes you get stuck in like a purgatory of sorts where messages are almost all missing and going either up or down scrolls in the wrong direction.

Other than that, it seems like scrolling backwards now gets stuck more often than before.

@tomholford
Copy link
Contributor Author

@arthyn Okay thanks, will look into this

@vercel vercel bot temporarily deployed to Preview – homestead-storybook November 21, 2022 06:38 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead November 21, 2022 06:39 Inactive
@vercel vercel bot temporarily deployed to Preview – chatstead November 21, 2022 06:40 Inactive
As luck would have it, an issue that I was struggling with on mobile has been fixed in a recent update:

petyosi/react-virtuoso#788

Went through the list of breaking changes and confirmed we are not affected.
@vercel vercel bot temporarily deployed to Preview – homestead November 21, 2022 07:03 Inactive
@vercel vercel bot temporarily deployed to Preview – chatstead November 21, 2022 07:04 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead-storybook November 21, 2022 07:05 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead-storybook November 21, 2022 20:53 Inactive
@vercel vercel bot temporarily deployed to Preview – chatstead November 21, 2022 20:53 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead November 21, 2022 20:54 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead-storybook November 21, 2022 21:16 Inactive
@vercel vercel bot temporarily deployed to Preview – chatstead November 21, 2022 21:17 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead November 21, 2022 21:18 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead November 21, 2022 21:32 Inactive
@vercel vercel bot temporarily deployed to Preview – chatstead November 21, 2022 21:33 Inactive
@vercel vercel bot temporarily deployed to Preview – homestead-storybook November 21, 2022 21:37 Inactive
@arthyn arthyn merged commit 853f921 into master Nov 21, 2022
@arthyn arthyn deleted the t/1187-performance-enhancements branch November 21, 2022 21:47
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.

chat: sending a message doesn't scroll to bottom sometimes
3 participants