File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
packages/react-router/lib/router Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " react-router " : patch
3+ ---
4+
5+ Fix Data Mode regression causing a 404 during initial load in when ` middleware ` exists without any ` loader ` functions
Original file line number Diff line number Diff line change @@ -5751,6 +5751,19 @@ function getDataStrategyMatch(
57515751 ! isMutationMethod ( request . method ) &&
57525752 ( match . route . lazy || match . route . loader ) )
57535753 ) {
5754+ // If this match was marked `shouldLoad` due to a middleware and it
5755+ // doesn't have a `loader` to run and no `lazy` to add one, then we can
5756+ // just return undefined from the "loader" here
5757+ if (
5758+ match . route . middleware &&
5759+ match . route . middleware . length > 0 &&
5760+ match . route . loader == null &&
5761+ ! match . route . lazy &&
5762+ ! handlerOverride
5763+ ) {
5764+ return Promise . resolve ( { type : ResultType . data , result : undefined } ) ;
5765+ }
5766+
57545767 return callLoaderOrAction ( {
57555768 request,
57565769 match,
You can’t perform that action at this time.
0 commit comments