Skip to content

chore: cleanup unused exports#6735

Merged
schiller-manuel merged 1 commit intomainfrom
clean-exports
Feb 22, 2026
Merged

chore: cleanup unused exports#6735
schiller-manuel merged 1 commit intomainfrom
clean-exports

Conversation

@schiller-manuel
Copy link
Contributor

@schiller-manuel schiller-manuel commented Feb 22, 2026

Summary by CodeRabbit

Release Notes

  • Refactor
    • Removed unused internal utilities and hooks from router implementations.
    • Streamlined public API exports across packages by removing deprecated symbols and consolidating unnecessary re-exports.
    • Optimized bundle size through elimination of empty hooks and unused helper functions.
    • Reduced public surface area for cleaner and more maintainable interfaces.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

📝 Walkthrough

Walkthrough

This PR removes several public API exports across the TanStack Router packages, including TSR_DEFERRED_PROMISE, defaultSerializeError, matchContext, useLayoutEffect utilities, and various helpers like componentTypes and headersInitToObject. The public API surface is narrowed across react-router, solid-router, vue-router, and router-core packages, along with cleanup in e2e bundle-size test scenarios.

Changes

Cohort / File(s) Summary
E2E Bundle-Size Scenario Cleanup
e2e/bundle-size/scenarios/react-router-full/src/routes/__root.tsx, e2e/bundle-size/scenarios/react-start-full/src/routes/__root.tsx, e2e/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx, e2e/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx, e2e/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx
Removed useLayoutEffect and useStableCallback imports, calls, and references from test scenario components; eliminates unused hook invocations.
React Router Public Exports
packages/react-router/src/index.tsx
Removed public exports: TSR_DEFERRED_PROMISE, defaultSerializeError, matchContext, useLayoutEffect; narrowed @tanstack/router-core re-exports to only lazyFn and SearchParamError.
Solid Router Public Exports
packages/solid-router/src/index.tsx
Removed public exports: TSR_DEFERRED_PROMISE, defaultSerializeError, matchContext, useLayoutEffect; narrowed @tanstack/router-core re-exports to only lazyFn and SearchParamError.
Solid Router Utils
packages/solid-router/src/utils.ts
Removed exported useLayoutEffect utility function that mapped to Solid.createRenderEffect or Solid.createEffect.
Vue Router Public Exports
packages/vue-router/src/index.tsx
Removed public exports: TSR_DEFERRED_PROMISE, defaultSerializeError, matchContext, useLayoutEffect; replaced multi-line @tanstack/router-core re-exports with single export of lazyFn and SearchParamError.
Router Core Public Exports
packages/router-core/src/index.ts
Removed exports: componentTypes, last, decodePath, RawStreamSSRPlugin; updated rewrite exports to remove executeRewriteOutput.
Router Core SSR Headers
packages/router-core/src/ssr/client.ts, packages/router-core/src/ssr/headers.ts
Removed headersInitToObject utility function and its re-export from client module; eliminates HeadersInit conversion helper.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #5587: Directly inverse relationship—that PR adds/documents symbols like TSR_DEFERRED_PROMISE and defaultSerializeError that this PR removes from the public API.
  • #6514: Related SSR headers refactoring—both PRs modify router-core header utilities, with this PR removing headersInitToObject while the other refactors mergeHeaders and type definitions.

Suggested labels

package: react-router, package: router-core, package: solid-router, package: vue-router

Suggested reviewers

  • nlynzaad

Poem

🐰 The exports shrink with gentle care,
Old hooks and helpers fade away,
A leaner API breathes the air,
The public surface, sleek to stay! ✨

🚥 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 'chore: cleanup unused exports' accurately summarizes the main change—removing unused exports across multiple packages and e2e scenarios.
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 clean-exports

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

@nx-cloud
Copy link

nx-cloud bot commented Feb 22, 2026

View your CI Pipeline Execution ↗ for commit 02dda60

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

☁️ Nx Cloud last updated this comment at 2026-02-22 23:11:13 UTC

@github-actions
Copy link

Bundle Size Benchmarks

  • Commit: 217cda0288cf
  • Measured at: 2026-02-22T22:54:50.559Z
  • Baseline source: history:eeb8c5594b3c
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 86.72 KiB 0 B (0.00%) 272.45 KiB 75.31 KiB ▅▅▅▅▅██▁
react-router.full 89.75 KiB -42 B (-0.05%) 282.78 KiB 78.01 KiB ███████▄▁
solid-router.minimal 35.98 KiB -8 B (-0.02%) 107.59 KiB 32.28 KiB █████▆▆▂▁
solid-router.full 40.31 KiB -24 B (-0.06%) 120.64 KiB 36.15 KiB █████▇▇▃▁
vue-router.minimal 51.82 KiB -8 B (-0.02%) 147.59 KiB 46.58 KiB █████▆▆▂▁
vue-router.full 56.67 KiB -22 B (-0.04%) 163.18 KiB 50.90 KiB █████▆▆▃▁
react-start.minimal 99.22 KiB 0 B (0.00%) 311.44 KiB 85.84 KiB ▇▇▇▇▇██▁
react-start.full 102.54 KiB -51 B (-0.05%) 321.22 KiB 88.64 KiB ███████▄▁
solid-start.minimal 48.22 KiB -6 B (-0.01%) 145.02 KiB 42.67 KiB █████▇▇▂▁
solid-start.full 53.69 KiB -20 B (-0.04%) 160.93 KiB 47.29 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 Feb 22, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 02dda60

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 (1)
packages/router-core/src/index.ts (1)

448-448: Public API trim — please ensure release notes/migration mention executeRewriteOutput removal.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/router-core/src/index.ts` at line 448, The public export currently
re-exports composeRewrites and executeRewriteInput but the review notes that
executeRewriteOutput was removed from the public API; update the package's
public API surface to reflect this change by removing any remaining re-exports
or references to executeRewriteOutput (check files/exports referencing
executeRewriteOutput and the export statement that includes
composeRewrites/executeRewriteInput), and add a brief migration note in the
release notes explaining that executeRewriteOutput was removed and how consumers
should migrate (e.g., use executeRewriteInput or composeRewrites instead).
🤖 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/index.ts`:
- Line 448: The public export currently re-exports composeRewrites and
executeRewriteInput but the review notes that executeRewriteOutput was removed
from the public API; update the package's public API surface to reflect this
change by removing any remaining re-exports or references to
executeRewriteOutput (check files/exports referencing executeRewriteOutput and
the export statement that includes composeRewrites/executeRewriteInput), and add
a brief migration note in the release notes explaining that executeRewriteOutput
was removed and how consumers should migrate (e.g., use executeRewriteInput or
composeRewrites instead).

@schiller-manuel schiller-manuel merged commit d6af3a2 into main Feb 22, 2026
8 checks passed
@schiller-manuel schiller-manuel deleted the clean-exports branch February 22, 2026 23:19
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