@@ -4934,26 +4934,28 @@ async function loadLazyMiddleware(
49344934 return ;
49354935 }
49364936
4937- let middleware = await route . unstable_lazyMiddleware ( ) ;
4938-
4939- // If the lazy function was executed and removed by another parallel
4940- // call then we can return - first call to finish wins because the return
4941- // value is expected to be static
4942- if ( ! route . unstable_lazyMiddleware ) {
4943- return ;
4944- }
4945-
49464937 let routeToUpdate = manifest [ route . id ] ;
49474938 invariant ( routeToUpdate , "No route found in manifest" ) ;
49484939
4949- warning (
4950- ! routeToUpdate . unstable_middleware ,
4951- `Route "${ routeToUpdate . id } " has a static property "unstable_middleware" ` +
4952- `defined. The "unstable_lazyMiddleware" function will be ignored.`
4953- ) ;
4940+ if ( routeToUpdate . unstable_middleware ) {
4941+ warning (
4942+ false ,
4943+ `Route "${ routeToUpdate . id } " has a static property "unstable_middleware" ` +
4944+ `defined. The "unstable_lazyMiddleware" function will be ignored.`
4945+ ) ;
4946+ } else {
4947+ let middleware = await route . unstable_lazyMiddleware ( ) ;
49544948
4955- if ( ! routeToUpdate . unstable_middleware ) {
4956- routeToUpdate . unstable_middleware = middleware ;
4949+ // If the `unstable_lazyMiddleware` function was executed and removed by
4950+ // another parallel call then we can return - first call to finish wins
4951+ // because the return value is expected to be static
4952+ if ( ! route . unstable_lazyMiddleware ) {
4953+ return ;
4954+ }
4955+
4956+ if ( ! routeToUpdate . unstable_middleware ) {
4957+ routeToUpdate . unstable_middleware = middleware ;
4958+ }
49574959 }
49584960
49594961 routeToUpdate . unstable_lazyMiddleware = undefined ;
0 commit comments