-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Reduce RouterProvider re-renders when using View Transitions #11803
Conversation
This reverts commit 3261e08.
🦋 Changeset detectedLatest commit: 07dc5db The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
future={{ | ||
v7_relativeSplatPath: router.future.v7_relativeSplatPath, | ||
}} | ||
future={routerFuture} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memoized above to ensure object stability across re-renders
> | ||
{state.initialized || router.future.v7_partialHydration ? ( | ||
<DataRoutes | ||
<MemoizedDataRoutes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has to React.memo
this in order to avoid unnecessary re-renders of route components when we updated ViewTransitionContext
.
I would have thought I'd have needed to memoize Router
as well but it doesn't appear that one needs to be changed...I'm unsure why though?
This reverts commit 234a294.
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
@brophdawg11 since this change i have problems with updating content on a page (in my react app). when i change text by clicking a button, this is only changed when the button is clicked again or when a button is pressed (“keydown-event”) or the rendering is only partially executed for some components after a short waiting time. |
Could you please open a new issue with a minimal reproduction? Thanks! |
By
memo
-ing thefuture
prop andDataRoutes
we can avoid unnecessary re-renders when we set theViewTransitionContext