You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The router core extracts parent context computation into a new private method getParentContext, replaces per-route callbacks with indexed for loops, refactors search-parameter resolution into deterministic local variables, and switches match updates from object spread to Object.assign, preserving existing behavior.
Changes
Cohort / File(s)
Summary
Router context and match resolution packages/router-core/src/router.ts
Added private getParentContext(parentMatch?). Refactored matchRoutesInternal to use indexed for loops, pre-sized matches array, deterministic local bindings for preMatchSearch/strictMatchSearch/searchError, conditional error throwing based on opts.throwOnError, and explicit Object.assign mutations when updating/creating matches. Context propagation now uses this.getParentContext(...) throughout.
🐰 In loops I hop and tidy the trail,
Contexts gathered, no more detail frail,
Params sorted neat, errors caught with care,
Matches aligned, all set to share,
A rabbit's small cheer for code made fair 🥕
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
✅ Passed
The title clearly describes the main change: performance optimizations to matchRoutesInternal in router-core through refactoring, which aligns with the detailed changes in the PR.
Docstring Coverage
✅ Passed
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
📝 Generate docstrings
🧪 Generate unit tests (beta)
Create PR with unit tests
Post copyable unit tests in a comment
Commit unit tests in branch refactor-router-core-match-routes-internal-minor-perf
Comment @coderabbitai help to get the list of available commands and usage tips.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some minor performance optimizations on
matchRoutesInternalgetParentContextis separate, because it doesn't need the scope of matchRoutesInternalmatchesarray has a size known in advance, so we can avoidpushforloops instead of.forEach()let+ a code blockBefore
After
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.