Skip to content

Conversation

@brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Nov 10, 2025

This PR wires up a new unstable_transitions flag on the routers that gives you control over the behavior of React transitions in React Router.

  • unstable_transitions={undefined} - Current behavior - Router state updates are wrapped in React.startTransition
    • We have found that this has some issues in React 19 when you wrap your own navigations in startTransition (i.e., startTransition(() => navigate('/'))) because internal mid-navigation state updates aren't surfaced in the current UI (i.e., useNavigation is stale during the navigation)
  • unstable_transitions={true} - Opt-into additional transition-related behavior inside React Router
    • Navigations will now also be wrapped in React.startTransition (useNavigate, Link, useSubmit, Form)
    • In React 19, Framework/Data Router state updates will also be sent through React.useOptimistic so they can surface to the UI mid-navigation
  • unstable_transitions={false} - Opt-out of all usage of React.startTransition/React.useOptimistic
    • Choosing this will mean that your application is likely not fully compatible with modern React features like <Suspense>, <ViewTransition>, use(), etc.
    • This might be required for your app if you are using React.useSyncExternalStore which is not compatible with transitions (1, 2)

RFC: #12855

TODO:

  • Feature detect useOptimistic since it's a react 19 API
  • More tests around fetchers surfacing mid navigation

@changeset-bot
Copy link

changeset-bot bot commented Nov 10, 2025

🦋 Changeset detected

Latest commit: 1966bff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
react-router Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch

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

@brophdawg11 brophdawg11 linked an issue Nov 13, 2025 that may be closed by this pull request
@brophdawg11 brophdawg11 marked this pull request as ready for review November 19, 2025 21:19
@brophdawg11 brophdawg11 changed the title Wire up support for unstable_transitions flag Wire up support for unstable_useTransitions flag Nov 20, 2025
@brophdawg11 brophdawg11 merged commit 707ecef into dev Nov 20, 2025
5 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/transitions branch November 20, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow opting out of startTransition

3 participants