File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/react-router/lib/dom/ssr Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -444,6 +444,16 @@ export function createClientRoutes(
444444
445445 // Load all other modules via route.lazy()
446446 dataRoute . lazy = async ( ) => {
447+ if ( route . clientLoaderModule || route . clientActionModule ) {
448+ // If a client loader/action chunk is present, we push the loading of
449+ // the main route chunk to the next tick to ensure the downloading of
450+ // loader/action chunks takes precedence. This can be seen via their
451+ // order in the network tab. Also note that since this is happening
452+ // within `route.lazy`, this imperceptible delay only happens on the
453+ // first load of this route.
454+ await new Promise ( ( resolve ) => setTimeout ( resolve , 0 ) ) ;
455+ }
456+
447457 let mod = await loadRouteModuleWithBlockingLinks (
448458 route ,
449459 routeModulesCache
You can’t perform that action at this time.
0 commit comments