Skip to content

Commit 847a917

Browse files
committed
Update order of operations to avoid uncessesary shouldRevalidate calls
1 parent e31a5c1 commit 847a917

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/react-router/lib/router/router.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3039,10 +3039,10 @@ export function createRouter(init: RouterInit): Router {
30393039
if (!isMutationMethod(request.method)) {
30403040
for (let match of matches) {
30413041
if (
3042-
match.shouldCallHandler() &&
30433042
!results.hasOwnProperty(match.route.id) &&
30443043
!state.loaderData.hasOwnProperty(match.route.id) &&
3045-
(!state.errors || !state.errors.hasOwnProperty(match.route.id))
3044+
(!state.errors || !state.errors.hasOwnProperty(match.route.id)) &&
3045+
match.shouldCallHandler()
30463046
) {
30473047
results[match.route.id] = {
30483048
type: ResultType.error,

0 commit comments

Comments
 (0)