Skip to content

Commit cb0b692

Browse files
authored
fix(router-core): reduce maskedLocation builds (#5081)
As highlighted by #5062 when using a mask, the location is being built multiple times. While we need to build the next path as well as the mask, the mask is being built twice. this PR fixes that by using the first build of the mask as the maskedLocation for the next path. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Optimized routing logic to avoid redundant work when applying masked destinations, reducing unnecessary computation during navigation. No changes to behavior or public APIs. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent f158256 commit cb0b692

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

packages/router-core/src/router.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,8 +1620,7 @@ export class RouterCore<
16201620
}
16211621

16221622
if (maskedNext) {
1623-
const maskedFinal = build(maskedDest)
1624-
next.maskedLocation = maskedFinal
1623+
next.maskedLocation = maskedNext
16251624
}
16261625

16271626
return next

0 commit comments

Comments
 (0)