File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
packages/react-router/lib/router Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -2311,19 +2311,6 @@ export function createRouter(init: RouterInit): Router {
2311
2311
interruptActiveLoads ( ) ;
2312
2312
fetchLoadMatches . delete ( key ) ;
2313
2313
2314
- function detectAndHandle405Error ( m : AgnosticDataRouteMatch ) {
2315
- if ( ! m . route . action && ! m . route . lazy ) {
2316
- let error = getInternalRouterError ( 405 , {
2317
- method : submission . formMethod ,
2318
- pathname : path ,
2319
- routeId : routeId ,
2320
- } ) ;
2321
- setFetcherError ( key , routeId , error , { flushSync } ) ;
2322
- return true ;
2323
- }
2324
- return false ;
2325
- }
2326
-
2327
2314
// Put this fetcher into it's submitting state
2328
2315
let existingFetcher = state . fetchers . get ( key ) ;
2329
2316
updateFetcherState ( key , getSubmittingFetcher ( submission , existingFetcher ) , {
@@ -2366,7 +2353,13 @@ export function createRouter(init: RouterInit): Router {
2366
2353
2367
2354
let match = getTargetMatch ( requestMatches , path ) ;
2368
2355
2369
- if ( detectAndHandle405Error ( match ) ) {
2356
+ if ( ! match . route . action && ! match . route . lazy ) {
2357
+ let error = getInternalRouterError ( 405 , {
2358
+ method : submission . formMethod ,
2359
+ pathname : path ,
2360
+ routeId : routeId ,
2361
+ } ) ;
2362
+ setFetcherError ( key , routeId , error , { flushSync } ) ;
2370
2363
return ;
2371
2364
}
2372
2365
You can’t perform that action at this time.
0 commit comments