Allow opting out of startTransition #12855
Replies: 4 comments 4 replies
-
|
I'm using "createBrowserRouter" in a Redux app. The app is quite up to date, with latest versions of React Redux, RTK Query, etc etc. However, I'm definitely seeing some weird behavior when trying to upgrade to v7. I'm on the second attempt now, and I'm thinking I might just have to drop it until this opt-out is supported. I'm not sure Redux is considered concurrent safe these days? Please allow for opting out of startTransition. Any chance of this being supported @brophdawg11 ? |
Beta Was this translation helpful? Give feedback.
-
|
After looking into the code of RouterProvider a bit I noticed that you can provide a flushSync implementation, so that when providing "flushSync: true" on router.navigate calls you can actually opt-out of startTransition for some of the navigation at least. |
Beta Was this translation helpful? Give feedback.
-
|
Leaving here a mention of how we "solved it" in case it helps: I agree with this proposal. Again, hope it helps! |
Beta Was this translation helpful? Give feedback.
-
|
We're also experiencing significant issues with the mandatory startTransition behavior in React Router v7. Our application uses a component with URL state synchronization, and we've encountered race conditions where searchParams updates are asynchronous, causing stale values to be applied in certain effects. This didn't occur in v6. The timing differences introduced by startTransition have forced us to implement workarounds using refs to track our own state changes and distinguish them from external URL updates. While we've managed to patch these issues, it's added considerable complexity to what was previously straightforward state-to-URL synchronization. We strongly support adding an opt-out mechanism for startTransition. Not every application benefits from this feature, and having it forced upon all navigation makes migration from v6 unnecessarily difficult. An option to disable it would greatly help applications that rely on immediate, synchronous updates. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Original issue here #12552, and paraphrasing my comment directly:
After a few unsuccessful attempts to migrate to v7, my thoughts are still the same.
This issue can be solved in one of the two ways:
startTransition.startTransition, but internally useuseDeferredValueto get the router state. Expose another hook likeuseLocationSyncthat can get the non-deferred router state so that users can opt-out and build their custom hooks upon that. This is more effort and I don't know if it would work well.I think
startTransitionis incompatible with most client-side applications, and it will be too late when people start noticing this. Please don't let this be another nail in the coffin for client-side React.Beta Was this translation helpful? Give feedback.
All reactions