Skip to content

refactor(router-core): remove unnecessary interpolatePath() in buildLocation#6721

Merged
Sheraff merged 2 commits intomainfrom
refactor-router-core-remove-unnecessary-interpolate-path-build-location
Feb 22, 2026
Merged

refactor(router-core): remove unnecessary interpolatePath() in buildLocation#6721
Sheraff merged 2 commits intomainfrom
refactor-router-core-remove-unnecessary-interpolate-path-build-location

Conversation

@Sheraff
Copy link
Contributor

@Sheraff Sheraff commented Feb 21, 2026

I think this code is not useful. So even without perf validation, it should be removed.

Benchmark

Minor but seemingly consistent improvement on a link-heavy SSR benchmark

Branch Commit Total requests Requests/sec Latency (avg) Latency (p99) Throughput
main 5fcf33e 66,526 2,217.94 2.80 ms 8 ms 24.21 MB/s
refactor-router-core-remove-unnecessary-interpolate-path-build-location a7fa041 67,451 2,248.9 2.78 ms 8 ms 24.55 MB/s
Delta (refactor - main)   +925 (+1.39%) +30.96 (+1.40%) -0.02 ms (-0.71%) 0 ms +0.34 MB/s (+1.40%)

Summary by CodeRabbit

  • Refactor
    • Optimized router core logic for route matching and path resolution, streamlining internal processing while maintaining existing functionality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

The PR refactors the buildLocation method in RouterCore to simplify destination route matching. It removes reliance on interpolated paths for matching, instead using nextTo directly. The global-not-found detection logic is simplified, and the changedParams-tracking mechanism is removed, ensuring path interpolation always occurs.

Changes

Cohort / File(s) Summary
Router Core BuildLocation Logic
packages/router-core/src/router.ts
Refactored destination route matching to use nextTo directly instead of interpolated paths; simplified global-not-found detection based on foundRoute existence; removed changedParams tracking; ensured consistent path interpolation via interpolatePath.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

package: router-core

Suggested reviewers

  • schiller-manuel
  • nlynzaad

Poem

🐰 A cleaner path now guides the way,
No interpolation delays the day,
Direct matching, swift and true,
BuildLocation made anew! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main refactoring objective: removing unnecessary interpolatePath() calls in the buildLocation function, which aligns with the core changes summarized 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 (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-router-core-remove-unnecessary-interpolate-path-build-location

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

@nx-cloud
Copy link

nx-cloud bot commented Feb 21, 2026

View your CI Pipeline Execution ↗ for commit 9d5bf2c

Command Status Duration Result
nx run tanstack-router-e2e-bundle-size:build --... ✅ Succeeded 1m 25s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-21 18:58:50 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 21, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6721

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@6721

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6721

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@6721

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@6721

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@6721

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@6721

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6721

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6721

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6721

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@6721

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@6721

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@6721

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@6721

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@6721

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@6721

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@6721

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@6721

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@6721

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@6721

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@6721

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@6721

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6721

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6721

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6721

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6721

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6721

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6721

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6721

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@6721

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6721

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6721

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6721

@tanstack/vue-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6721

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-devtools@6721

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-ssr-query@6721

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6721

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6721

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6721

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6721

commit: 9d5bf2c

@Sheraff Sheraff requested a review from nlynzaad February 21, 2026 14:14
@github-actions
Copy link
Contributor

Bundle Size Benchmarks

  • Commit: d8d626b64bf0
  • Measured at: 2026-02-21T18:48:50.949Z
  • Baseline source: history:b8f166506d77
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 86.78 KiB +24 B (+0.03%) 272.59 KiB 75.35 KiB ▁█
react-router.full 89.84 KiB -7 B (-0.01%) 283.07 KiB 78.09 KiB █▁
solid-router.minimal 36.03 KiB -14 B (-0.04%) 107.76 KiB 32.40 KiB █▁
solid-router.full 40.38 KiB -15 B (-0.04%) 120.84 KiB 36.24 KiB █▁
vue-router.minimal 51.87 KiB -28 B (-0.05%) 147.75 KiB 46.62 KiB █▁
vue-router.full 56.73 KiB -28 B (-0.05%) 163.36 KiB 51.00 KiB █▁
react-start.minimal 99.25 KiB +3 B (+0.00%) 311.59 KiB 85.95 KiB ▁█
react-start.full 102.65 KiB -4 B (-0.00%) 321.50 KiB 88.74 KiB █▁
solid-start.minimal 48.27 KiB -7 B (-0.01%) 145.19 KiB 42.69 KiB █▁
solid-start.full 53.75 KiB -10 B (-0.02%) 161.14 KiB 47.39 KiB █▁

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

@Sheraff Sheraff merged commit 63e9e71 into main Feb 22, 2026
8 checks passed
@Sheraff Sheraff deleted the refactor-router-core-remove-unnecessary-interpolate-path-build-location branch February 22, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants