Skip to content

less unnecessary url#6969

Open
huseeiin wants to merge 4 commits intoTanStack:mainfrom
huseeiin:less-url
Open

less unnecessary url#6969
huseeiin wants to merge 4 commits intoTanStack:mainfrom
huseeiin:less-url

Conversation

@huseeiin
Copy link
Contributor

@huseeiin huseeiin commented Mar 18, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved server request origin handling to remove unnecessary URL operations, reducing redundant processing during SSR/start handlers.
  • Chores

    • Added release metadata to trigger a minor version bump and note a small URL creation reduction.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: edb90752-f793-4ba6-aefa-7dede9a85f6e

📥 Commits

Reviewing files that changed from the base of the PR and between e0c8a99 and 57f546f.

📒 Files selected for processing (2)
  • packages/router-core/src/ssr/createRequestHandler.ts
  • packages/start-server-core/src/createStartHandler.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/start-server-core/src/createStartHandler.ts
  • packages/router-core/src/ssr/createRequestHandler.ts

📝 Walkthrough

Walkthrough

Replaces getOrigin(request) calls with url.origin derived from the normalized URL (via getNormalizedURL) in two server-side handler files; adds a changeset file bumping @tanstack/start-server-core version.

Changes

Cohort / File(s) Summary
Changeset
\.changeset/neat-taxes-feel.md
New changeset file added: minor version bump for @tanstack/start-server-core with a note about reducing unnecessary URL creation.
Server handler updates
packages/router-core/src/ssr/createRequestHandler.ts, packages/start-server-core/src/createStartHandler.ts
Replaced usage of getOrigin(request) with url.origin obtained from getNormalizedURL(request); adjusted imports accordingly; no other control-flow changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I hopped through handlers, light and spry,
Snipped one extra URL, oh my my!
Origin now from the normalized stream,
Leaner code and a brighter dream.
✨🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly relates to the main change in the changeset: reducing unnecessary URL object creation by deriving the origin from the normalized URL instead of calling getOrigin().

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Mar 18, 2026

View your CI Pipeline Execution ↗ for commit 57f546f

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

☁️ Nx Cloud last updated this comment at 2026-03-18 09:00:39 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

Bundle Size Benchmarks

  • Commit: b065aee927c4
  • Measured at: 2026-03-18T08:45:46.914Z
  • Baseline source: history:6651473d028a
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 87.61 KiB 0 B (0.00%) 276.07 KiB 76.12 KiB ▁▁▁▁▁▁▁████
react-router.full 90.65 KiB 0 B (0.00%) 286.28 KiB 78.68 KiB ▁▁▁▁▁▁▁████
solid-router.minimal 37.14 KiB 0 B (0.00%) 111.38 KiB 33.29 KiB ▁▁▁▁▁▁▁████
solid-router.full 41.36 KiB 0 B (0.00%) 124.18 KiB 37.12 KiB ▁▁▁▁▁▁▁████
vue-router.minimal 52.99 KiB 0 B (0.00%) 151.41 KiB 47.65 KiB ▁▁▁▁▁▁▁████
vue-router.full 57.69 KiB 0 B (0.00%) 166.34 KiB 51.60 KiB ▁▁▁▁▁▁▁████
react-start.minimal 101.99 KiB 0 B (0.00%) 324.08 KiB 88.20 KiB ▁▁▁▁▁▁▁████
react-start.full 105.33 KiB 0 B (0.00%) 333.89 KiB 91.02 KiB ▁▁▁▁▁▁▁████
solid-start.minimal 51.24 KiB 0 B (0.00%) 157.82 KiB 45.28 KiB ▁▁▁▁▁▁▁████
solid-start.full 56.53 KiB 0 B (0.00%) 173.32 KiB 49.72 KiB ▁▁▁▁▁▁▁████

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 18, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 57f546f

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 18, 2026

Merging this PR will not alter performance

✅ 3 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing huseeiin:less-url (57f546f) with main (6651473)2

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (b065aee) during the generation of this report, so 6651473 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/start-server-core/src/createStartHandler.ts (1)

14-17: Remove unused getOrigin import.

The getOrigin function is no longer used after the refactor. Keeping unused imports can cause confusion and may trigger linter warnings.

🔧 Suggested fix
 import {
   attachRouterServerSsrUtils,
   getNormalizedURL,
-  getOrigin,
 } from '@tanstack/router-core/ssr/server'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/start-server-core/src/createStartHandler.ts` around lines 14 - 17,
Remove the unused getOrigin import from the import list that currently includes
attachRouterServerSsrUtils and getNormalizedURL in createStartHandler.ts; locate
the import statement referencing '@tanstack/router-core/ssr/server' and delete
only the getOrigin symbol so the remaining imports remain intact to avoid linter
warnings.
packages/router-core/src/ssr/createRequestHandler.ts (1)

3-7: Remove unused getOrigin import.

After the refactor, getOrigin is no longer used in this file.

🔧 Suggested fix
 import {
   attachRouterServerSsrUtils,
   getNormalizedURL,
-  getOrigin,
 } from './ssr-server'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/router-core/src/ssr/createRequestHandler.ts` around lines 3 - 7, The
import list in createRequestHandler.ts still includes the now-unused symbol
getOrigin; update the import from './ssr-server' to remove getOrigin and only
import the used symbols (attachRouterServerSsrUtils and getNormalizedURL) so the
file no longer imports an unused identifier, ensuring no other references to
getOrigin remain in the file (e.g., check any usages around
attachRouterServerSsrUtils or getNormalizedURL).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/router-core/src/ssr/createRequestHandler.ts`:
- Around line 3-7: The import list in createRequestHandler.ts still includes the
now-unused symbol getOrigin; update the import from './ssr-server' to remove
getOrigin and only import the used symbols (attachRouterServerSsrUtils and
getNormalizedURL) so the file no longer imports an unused identifier, ensuring
no other references to getOrigin remain in the file (e.g., check any usages
around attachRouterServerSsrUtils or getNormalizedURL).

In `@packages/start-server-core/src/createStartHandler.ts`:
- Around line 14-17: Remove the unused getOrigin import from the import list
that currently includes attachRouterServerSsrUtils and getNormalizedURL in
createStartHandler.ts; locate the import statement referencing
'@tanstack/router-core/ssr/server' and delete only the getOrigin symbol so the
remaining imports remain intact to avoid linter warnings.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ef7d2dac-fe25-4471-9dac-5b957ecf1750

📥 Commits

Reviewing files that changed from the base of the PR and between b065aee and e0c8a99.

📒 Files selected for processing (3)
  • .changeset/neat-taxes-feel.md
  • packages/router-core/src/ssr/createRequestHandler.ts
  • packages/start-server-core/src/createStartHandler.ts

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