-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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.
#4313
Conversation
|
Thanks @sanjaiyan-dev! Astro has client directives to control timing for components, so if you wanted to hydrate on idle you would do: |
Sorry, I have removed the |
According to Ryan Florence this would improve the load performance of the webpage. And by making hydrating without blocking main thread would enhance the performance too. My thoughts 💭 (might be misleading) Astro js support multiple JavaScript Frameworks 🤩 at the time and if any of the component doing some work which is high priority/heavy we can interrupt the hydration of react component for sleeker user experience 💪🙌 |
Thanks @sanjaiyan-dev. Can you explain exactly how If |
Reference from React js Docs Updates in a transition will not show a fallback for re-suspended content. This allows the user to continue interacting with the current content while rendering the update. Reference from tweet by React js team |
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 asked the question here: https://twitter.com/matthewcp/status/1562057134967328769 |
This will go out with the next minor release, thanks! |
Tks 💪🙌 |
This PR is heavily inspired from tweet by Ryan Florence.
I am extremely sorry if I made any mistakes :(