Skip to content

perf(router-core): inline buildWithMatches inside buildLocation - #8070

Merged
Sheraff merged 2 commits into
mainfrom
perf-router-core-inline-build-with-matches
Aug 14, 2026
Merged

perf(router-core): inline buildWithMatches inside buildLocation#8070
Sheraff merged 2 commits into
mainfrom
perf-router-core-inline-build-with-matches

Conversation

@Sheraff

@Sheraff Sheraff commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes

    • Explicit route masks now take precedence over configured route masks.
    • Masked locations are generated more consistently when building navigation destinations.
    • Navigation paths now reflect explicitly requested masking behavior more reliably.
  • Tests

    • Added coverage confirming explicit masks are used without evaluating configured mask parameters.
  • Chores

    • Included a patch release note for the router core package.
    • Reduced internal processing overhead when constructing navigation locations.

@nx-cloud

nx-cloud Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit f95b57c

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 12m 57s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m View ↗

☁️ Nx Cloud last updated this comment at 2026-08-14 19:50:38 UTC

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

4 package(s) bumped directly, 19 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.170.28 → 1.170.29 Changeset
@tanstack/router-core 1.171.23 → 1.171.24 Changeset
@tanstack/solid-router 1.170.26 → 1.170.27 Changeset
@tanstack/vue-router 1.170.25 → 1.170.26 Changeset
@tanstack/react-start 1.168.45 → 1.168.46 Dependent
@tanstack/react-start-client 1.168.26 → 1.168.27 Dependent
@tanstack/react-start-rsc 0.1.44 → 0.1.45 Dependent
@tanstack/react-start-server 1.167.33 → 1.167.34 Dependent
@tanstack/router-cli 1.167.29 → 1.167.30 Dependent
@tanstack/router-generator 1.167.29 → 1.167.30 Dependent
@tanstack/router-plugin 1.168.31 → 1.168.32 Dependent
@tanstack/router-vite-plugin 1.167.31 → 1.167.32 Dependent
@tanstack/solid-start 1.168.43 → 1.168.44 Dependent
@tanstack/solid-start-client 1.168.25 → 1.168.26 Dependent
@tanstack/solid-start-server 1.167.32 → 1.167.33 Dependent
@tanstack/start-client-core 1.170.23 → 1.170.24 Dependent
@tanstack/start-plugin-core 1.171.35 → 1.171.36 Dependent
@tanstack/start-server-core 1.169.27 → 1.169.28 Dependent
@tanstack/start-static-server-functions 1.167.28 → 1.167.29 Dependent
@tanstack/start-storage-context 1.167.25 → 1.167.26 Dependent
@tanstack/vue-start 1.168.42 → 1.168.43 Dependent
@tanstack/vue-start-client 1.167.28 → 1.167.29 Dependent
@tanstack/vue-start-server 1.167.32 → 1.167.33 Dependent

@coderabbitai

coderabbitai Bot commented Aug 14, 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: 220bd15b-da4b-460d-b832-06006903b9a9

📥 Commits

Reviewing files that changed from the base of the PR and between 329e655 and f95b57c.

📒 Files selected for processing (1)
  • packages/router-core/src/router.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/router-core/src/router.ts

📝 Walkthrough

Walkthrough

buildLocation now resolves location masks inline instead of using buildWithMatches. Explicit masks take precedence over configured route masks. Tests cover this behavior, and a patch Changeset was added.

Changes

Location mask handling

Layer / File(s) Summary
Inline mask resolution and precedence
packages/router-core/src/router.ts, packages/router-core/tests/mask.test.ts, .changeset/whole-bars-smash.md
buildLocation resolves explicit and configured route masks inline. Tests verify explicit mask precedence and callback omission. A patch Changeset records the implementation change.

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

Merge Risk: ⚪ Minimal · up to f95b5

This localized performance refactor is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Possibly related PRs

🚥 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 and concisely describes the main change: inlining buildWithMatches inside buildLocation for 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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf-router-core-inline-build-with-matches

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.

@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@8070

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@8070

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@8070

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@8070

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@8070

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@8070

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@8070

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@8070

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@8070

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@8070

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@8070

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@8070

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@8070

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@8070

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@8070

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@8070

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@8070

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@8070

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@8070

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@8070

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@8070

commit: f95b57c

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: e62db5430a21
  • Measured at: 2026-08-14T19:38:48.939Z
  • Baseline source: history:53b63cf6fbec
  • Dashboard: bundle-size history

The following scenarios have bundle-size changes compared with the baseline:

Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 83.84 KiB -58 B (-0.07%) 83.71 KiB 262.47 KiB 72.93 KiB ██▁▁▁▁▁▁▆▆▄▁
react-router.full 87.33 KiB -67 B (-0.07%) 87.19 KiB 274.18 KiB 76.01 KiB ██▂▂▂▂▂▃▆▆▃▁
solid-router.minimal 33.12 KiB -69 B (-0.20%) 32.99 KiB 96.12 KiB 29.85 KiB ██▄▄▄▄▅▅▅▅▃▁
solid-router.full 37.94 KiB -64 B (-0.16%) 37.82 KiB 110.76 KiB 34.17 KiB ██▄▄▄▄▄▄▄▄▃▁
vue-router.minimal 49.50 KiB -89 B (-0.18%) 49.38 KiB 138.30 KiB 44.69 KiB ▄▄▁▁▁█▇███▅▃
vue-router.full 55.11 KiB -88 B (-0.16%) 54.99 KiB 156.50 KiB 49.61 KiB ▄▄▁▁▁█████▆▄
react-start.minimal 96.64 KiB -83 B (-0.08%) 96.50 KiB 304.69 KiB 83.66 KiB ██▂▂▂▂▂▂▆▆▃▁
react-start.deferred-hydration 97.37 KiB -76 B (-0.08%) 96.53 KiB 306.05 KiB 84.48 KiB ██▂▂▂▂▂▁▆▆▃▁
react-start.full 99.80 KiB -95 B (-0.09%) 99.67 KiB 314.42 KiB 86.49 KiB ██▃▃▃▃▃▃▆▆▃▁
react-start.rsbuild.minimal 99.98 KiB -53 B (-0.05%) 99.81 KiB 315.07 KiB 86.19 KiB ██▁▁▁▁▁▁▅▅▅▂
react-start.rsbuild.minimal-iife 100.38 KiB -53 B (-0.05%) 100.22 KiB 316.01 KiB 86.59 KiB ██▁▁▁▁▁▁▆▆▅▂
react-start.rsbuild.full 103.30 KiB -55 B (-0.05%) 103.13 KiB 325.17 KiB 88.97 KiB ██▁▁▁▁▁▁▅▅▅▂
solid-start.minimal 45.87 KiB -91 B (-0.19%) 45.74 KiB 137.18 KiB 40.84 KiB ██▅▅▅▅▅▅▅▅▃▁
solid-start.deferred-hydration 48.95 KiB -81 B (-0.16%) 45.82 KiB 144.64 KiB 43.60 KiB ██▄▄▄▅▅▅▅▅▃▁
solid-start.full 50.97 KiB -71 B (-0.14%) 50.84 KiB 152.57 KiB 45.19 KiB ██▄▄▄▅▅▅▅▅▃▁
vue-start.minimal 65.56 KiB -79 B (-0.12%) 65.44 KiB 189.12 KiB 58.33 KiB ▄▄▁▁▁█████▆▅
vue-start.full 69.38 KiB -73 B (-0.10%) 69.25 KiB 201.42 KiB 61.64 KiB ▅▄▁▁▁█████▆▅

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.

@codspeed-hq

codspeed-hq Bot commented Aug 14, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 8.24%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 8 improved benchmarks
❌ 13 (👁 13) regressed benchmarks
✅ 159 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem server error-paths unmatched (vue) 625 KB 583.9 KB +7.04%
Simulation client-search-params navigation loop (react) 177.3 ms 168.4 ms +5.31%
Simulation client-async-pipeline navigation loop (react) 103.9 ms 99.4 ms +4.58%
Memory mem server aborted-requests (solid) 1.3 MB 1.2 MB +4.27%
Memory mem server server-fn-churn (vue) 340.7 KB 328.1 KB +3.86%
Simulation ssr request loop (solid) 446.1 ms 429.8 ms +3.79%
👁 Simulation ssr control-flow error 500 (react) 229.1 ms 240.4 ms -4.7%
👁 Simulation ssr control-flow route headers (react) 296.1 ms 311.6 ms -5%
👁 Memory mem server error-paths redirect (solid) 379.7 KB 392.8 KB -3.32%
👁 Memory mem server error-paths unmatched (solid) 541.8 KB 574.6 KB -5.71%
👁 Memory mem server peak-large-page (solid) 1.1 MB 1.1 MB -5.07%
👁 Memory mem server error-paths not-found (react) 382 KB 431.7 KB -11.52%
👁 Memory mem server error-paths redirect (react) 305.5 KB 320.9 KB -4.8%
👁 Memory mem server peak-large-page (react) 1.1 MB 2.3 MB -50.04%
👁 Memory mem server server-fn-churn (react) 376.3 KB 395.9 KB -4.94%
👁 Memory mem server aborted-requests (vue) 1 MB 1.1 MB -3.84%
👁 Memory mem server error-paths error (vue) 940.9 KB 2,301 KB -59.11%
👁 Simulation client-nested-params navigation loop (react) 212.8 ms 228.1 ms -6.7%
👁 Memory mem client preload-churn (vue) 758.5 KB 884.8 KB -14.27%
👁 Memory mem client unique-location-churn (vue) 614.2 KB 546.3 KB +12.43%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing perf-router-core-inline-build-with-matches (f95b57c) with main (cf6ab17)

Open in CodSpeed

@Sheraff
Sheraff merged commit bdaf73a into main Aug 14, 2026
26 checks passed
@Sheraff
Sheraff deleted the perf-router-core-inline-build-with-matches branch August 14, 2026 20:47
@github-actions github-actions Bot mentioned this pull request Aug 14, 2026
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.

1 participant