Skip to content

perf(router-core): use the simple interpolatePath lane on the client - #8090

Open
anonrig wants to merge 1 commit into
TanStack:mainfrom
anonrig:perf/interpolate-path-client-fast-path
Open

perf(router-core): use the simple interpolatePath lane on the client#8090
anonrig wants to merge 1 commit into
TanStack:mainfrom
anonrig:perf/interpolate-path-client-fast-path

Conversation

@anonrig

@anonrig anonrig commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Split out of #8085 so bundle size and performance can be measured independently.

The $param / $ scan already matches the braced parser for templates without {...}. Link-shaped to/params navigation can use it without waiting for isServer. Braced segments still go through parseSegment.

Test plan

  • packages/router-core/tests/path.test.ts
  • packages/router-core/tests/optional-path-params.test.ts
  • packages/router-core/tests/optional-path-params-clean.test.ts

Summary by CodeRabbit

  • Bug Fixes
    • Improved path interpolation consistency across server and client environments.
    • Plain paths and parameterized segments such as $param continue to resolve as expected.
  • Performance
    • Streamlined simple path handling for faster route resolution.

The `$param` / `$` scan already matches the braced parser for templates
without `{...}`. Link-shaped `to`/`params` navigation can use it without
waiting for `isServer`.
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 72b45a70-852d-4df1-a72f-9726f7fd1cf7

📥 Commits

Reviewing files that changed from the base of the PR and between f97188f and 854ab0a.

📒 Files selected for processing (1)
  • packages/router-core/src/path.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The path interpolation fast path no longer depends on the server environment. The implementation discards the internal server option while preserving parameter tracking, encoding, missing-parameter handling, splat aliases, and trailing-slash behavior.

Changes

Path interpolation

Layer / File(s) Summary
Enable the interpolation fast path in all environments
packages/router-core/src/path.ts
The plain-segment interpolation path now runs without the server-only guard. The internal server option is explicitly ignored. Existing interpolation behavior remains unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 854ab

The change routes eligible client navigation through a simpler path interpolation lane while retaining braced-segment parsing, with targeted tests listed; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

  • TanStack/router#7977: Both changes modify interpolatePath in packages/router-core/src/path.ts, but this PR removes the server-only guard while that PR changes substring calls to slice.

Suggested labels: package: router-core

Suggested reviewers: sheraff

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: enabling the simple interpolatePath lane for client-side router-core performance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant