refactor(router-core): clarify segment interpolation - #8319
refactor(router-core): clarify segment interpolation#8319schiller-manuel wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughPath interpolation now reuses one result object for the interpolated path, used parameters, and missing-parameter metadata. Parser handling for wildcard, optional, and named parameters was reorganized. Tests and benchmarks cover mixed segments and direct pathname interpolation. ChangesPath interpolation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change refactors internal path-interpolation logic and its metadata handling while preserving existing outputs, parameter behavior, and public API contracts. Investigation found no evidence of broken callers or behavioral regressions, so this refactor appears safe to merge with normal review confidence. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 2e22a79
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview4 package(s) bumped directly, 19 bumped as dependents. 🟩 Patch bumps
|
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better. |
Merging this PR will improve performance by 8.67%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | client-links navigation loop (react) |
216.8 ms | 190.4 ms | +13.82% |
| ⚡ | Simulation | client-links navigation loop (vue) |
344.7 ms | 321.7 ms | +7.14% |
| ⚡ | Simulation | client-links navigation loop (solid) |
522.7 ms | 496.7 ms | +5.25% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing optimize-link-segment-interpolation (2e22a79) with main (6494e75)1
Footnotes
3ed796e to
17e00ed
Compare
| keys?: Array<string>, | ||
| server?: boolean, | ||
| onMissing?: () => void, | ||
| metadata?: { isMissingParams: boolean }, |
There was a problem hiding this comment.
Nit but if this is meant to be an internal key, we might save a couple bytes w/ a shorter property name (or by using a tuple instead)
Organize the generic interpolation loop into static, wildcard, and named-parameter behavior blocks. Keep one shared key lookup, one encoding step, and one prefix/value/suffix assembly. Name affix boundaries and keep optional/missing wildcard behavior local to its segment type. Replace the self-clearing onMissing callback with an optional metadata result object. The public interpolatePath wrapper reuses its existing result object; pathname-only callers still allocate no metadata. Preserve one parameter read, the reusable parser buffer, absent optional cache keys, canonical and legacy splat metadata, and public return values. Fast-path empty splat strings before the URL-safe regex so sharing the encoding step does not penalize omitted values. Final official gzip measurements versus 5017a72: - React minimal: 85771 -> 85769 (-2 bytes). - React full: 89384 -> 89382 (-2 bytes). - All 18 fixtures range from -4 to +8 bytes; no unrelated source changes compensate for interpolation cost. Added mixed-type/affix metadata coverage and direct pathname-kernel benchmarks. Paired fixed-seed CPU measurements of the real parent/current modules show effectively flat required client pathname interpolation (+0.04%) and 0.37-4.14% lower time in the other sampled required/optional/splat/mixed/missing client/server combinations. These are focused kernel diagnostics, not a broad application speedup claim. Preserve the experiments, rejected larger variants, full fixture metrics, and raw benchmark output in uncommitted LOG.md and session artifacts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
17e00ed to
2e22a79
Compare
🎯 Changes
Simplify path interpolation into ordered segment blocks while preserving one-pass parsing and optional metadata collection.
This is PR 4 of a stacked series and is based on
optimize-link-solid-vue-state.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit
Improvements
Testing