Skip to content

Commit 7961270

Browse files
committed
Make flushSync opt out of transition
1 parent eb427b3 commit 7961270

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react-router/lib/hooks.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ function useNavigateUnstable(): NavigateFunction {
403403
if (!activeRef.current) return;
404404

405405
if (typeof to === "number") {
406-
if (unstable_transitions) {
406+
if (unstable_transitions && !options.flushSync) {
407407
React.startTransition(() => navigator.go(to));
408408
} else {
409409
navigator.go(to);
@@ -431,7 +431,7 @@ function useNavigateUnstable(): NavigateFunction {
431431
: joinPaths([basename, path.pathname]);
432432
}
433433

434-
if (unstable_transitions) {
434+
if (unstable_transitions && !options.flushSync) {
435435
React.startTransition(() => {
436436
if (options.replace === true) {
437437
navigator.replace(path, options.state, options);
@@ -1852,7 +1852,7 @@ function useNavigateStable(): NavigateFunction {
18521852
// is useless because we haven't wired up our router subscriber yet
18531853
if (!activeRef.current) return;
18541854

1855-
if (unstable_transitions) {
1855+
if (unstable_transitions && !options.flushSync) {
18561856
await new Promise<void>((resolve, reject) => {
18571857
// @ts-expect-error Needs React 19 types
18581858
React.startTransition(async () => {

0 commit comments

Comments
 (0)