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

Adding time-slicing with startTransition to prevent hydration from blocking the main thread for too long for those users who immediately scroll. #1970

Closed
wants to merge 6 commits into from

Conversation

sanjaiyan-dev
Copy link
Contributor

@sanjaiyan-dev sanjaiyan-dev commented Aug 11, 2022

This PR is heavily inspired from tweet by Ryan Florence.

Time slicing is the thing that keeps me firmly in the React camp. I've built so much UI in my career where user interactions can cause rapid UI updates.

Without time slicing, the main thread gets blocked and you get jank.

React 18 just solves--and hides--the problem completely.
https://twitter.com/ryanflorence/status/1547961298813497355?s=20&t=BxmSnZmZfN4nOyTVw5aOTQ

I am extremely sorry if I made any mistakes :(

Copy link
Contributor

@frehner frehner left a comment

Choose a reason for hiding this comment

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

Huh, interesting, thanks for adding this!

If you run yarn format in the root of the project, it should get rid of all the formatting changes you've pushed up and we can better see the changes you've made. Thanks!

@blittle thoughts?

@sanjaiyan-dev
Copy link
Contributor Author

Huh, interesting, thanks for adding this!

If you run yarn format in the root of the project, it should get rid of all the formatting changes you've pushed up and we can better see the changes you've made. Thanks!

@blittle thoughts?

Sorry, I used github web based editor so I couldn't run yarn format (Anyway i removed some of code formatting)

@natew
Copy link

natew commented Aug 18, 2022

Tested this on a larger page that gets ~94 on lighthouse, it didn't change the score or any of the metrics really, interestingly.

@blittle
Copy link
Contributor

blittle commented Aug 18, 2022

Thank you @sanjaiyan-dev! I think I'd like to play around with this a bit more and discuss with the team before we merge.

@sanjaiyan-dev
Copy link
Contributor Author

Thank you @sanjaiyan-dev! I think I'd like to play around with this a bit more and discuss with the team before we merge.

@blittle
Okay 💪🙌

Can you please say is this PR is acceptable Shopify/hydrogen#1968 please

@sanjaiyan-dev
Copy link
Contributor Author

Currently Astro js adopted to concurrental hydration -: withastro/astro#4313

@blittle
Copy link
Contributor

blittle commented Sep 7, 2022

@sanjaiyan-dev I'm closing this in favor of Shopify/hydrogen#1970 where I can start making some direct modifications. Thank you!

@blittle blittle closed this Sep 7, 2022
@sanjaiyan-dev
Copy link
Contributor Author

@sanjaiyan-dev I'm closing this in favor of #1970 where I can start making some direct modifications. Thank you!

Ok 💪

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.

4 participants