File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
packages/react/src/reactrouter-compat-utils Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -388,14 +388,23 @@ export function createV6CompatibleWrapCreateMemoryRouter<
388388 ( state . historyAction === 'POP' && isPageloadComplete ) ;
389389
390390 if ( shouldHandleNavigation ) {
391- handleNavigation ( {
392- location,
393- routes,
394- navigationType : state . historyAction ,
395- version,
396- basename,
397- allRoutes : Array . from ( allRoutes ) ,
398- } ) ;
391+ const navigationHandler = ( ) : void => {
392+ handleNavigation ( {
393+ location,
394+ routes,
395+ navigationType : state . historyAction ,
396+ version,
397+ basename,
398+ allRoutes : Array . from ( allRoutes ) ,
399+ } ) ;
400+ } ;
401+
402+ // Wait for the next render if loading an unsettled route
403+ if ( state . navigation . state !== 'idle' ) {
404+ requestAnimationFrame ( navigationHandler ) ;
405+ } else {
406+ navigationHandler ( ) ;
407+ }
399408 }
400409 } ) ;
401410
You can’t perform that action at this time.
0 commit comments