- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.3k
fix: various fixes #5215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: various fixes #5215
Conversation
this silences the following build warning: ``` vite v7.1.7 building for production... ../../../packages/start-client-core/dist/esm/client/hydrateStart.js (8:17): "startInstance" is not exported by "../../../packages/react-start/dist/plugin/default-entry/start.ts", imported by "../../../packages/start-client-core/dist/esm/client/hydrateStart.js". ```
| View your CI Pipeline Execution ↗ for commit c7135bc 
 ☁️ Nx Cloud last updated this comment at  | 
| WalkthroughDocumentation updates rename validator to inputValidator and adjust install commands and router API naming. Start/solid default-entry modules switch from default export to a named startInstance and adjust build externals. Client hydration now imports startInstance directly and handles its absence. Router plugin tweaks deleteNodes handling. Start plugin narrows runtime file filtering and adds a dependency. Changes
 Sequence Diagram(s)sequenceDiagram
  autonumber
  actor User
  participant Browser
  participant App as App Bootstrap
  participant Start as startInstance (from #tanstack-start-entry)
  participant Router
  User->>Browser: Load app
  Browser->>App: Execute hydrateStart()
  App->>Start: Import startInstance
  alt startInstance present
    App->>Start: getOptions()
    Start-->>App: startOptions
    App->>Browser: Set window.__TSS_START_OPTIONS__
    App->>App: Ensure serializationAdapters (append ServerFunctionSerializationAdapter)
  else startInstance absent
    App->>App: Initialize empty serializationAdapters<br/>Append ServerFunctionSerializationAdapter
    App->>Browser: Set window.__TSS_START_OPTIONS__ (fallback)
  end
  App->>Router: Apply serializationAdapters
  App->>Router: Hydrate if no existing matches
  Router-->>Browser: UI hydrated
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
 Suggested reviewers
 Poem
 Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
 ✅ Passed checks (1 passed)
 ✨ Finishing touches
 🧪 Generate unit tests
 Comment  | 
| More templates
 
 @tanstack/arktype-adapter
 @tanstack/directive-functions-plugin
 @tanstack/eslint-plugin-router
 @tanstack/history
 @tanstack/nitro-v2-vite-plugin
 @tanstack/react-router
 @tanstack/react-router-devtools
 @tanstack/react-router-ssr-query
 @tanstack/react-start
 @tanstack/react-start-client
 @tanstack/react-start-server
 @tanstack/router-cli
 @tanstack/router-core
 @tanstack/router-devtools
 @tanstack/router-devtools-core
 @tanstack/router-generator
 @tanstack/router-plugin
 @tanstack/router-ssr-query-core
 @tanstack/router-utils
 @tanstack/router-vite-plugin
 @tanstack/server-functions-plugin
 @tanstack/solid-router
 @tanstack/solid-router-devtools
 @tanstack/solid-start
 @tanstack/solid-start-client
 @tanstack/solid-start-server
 @tanstack/start-client-core
 @tanstack/start-plugin-core
 @tanstack/start-server-core
 @tanstack/start-static-server-functions
 @tanstack/start-storage-context
 @tanstack/valibot-adapter
 @tanstack/virtual-file-routes
 @tanstack/zod-adapter
 commit:  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️  Outside diff range comments (5)
docs/start/framework/react/observability.md (3)
37-48: Missing import for createServerFn in Sentry snippet.The snippet uses
createServerFn()without importing it.Apply this diff within the snippet:
// Server functions -import * as Sentry from '@sentry/node' +import * as Sentry from '@sentry/node' +import { createServerFn } from '@tanstack/react-start' const serverFn = createServerFn().handler(async () => {
100-113: Fix middleware handler signature: request is undefined.
requestis referenced but not passed into the handler.Apply this diff to include
requestand required imports:-import { createMiddleware } from '@tanstack/react-start' +import { createMiddleware, json } from '@tanstack/react-start' +import { createFileRoute } from '@tanstack/react-router' -const requestLogger = createMiddleware().handler(async ({ next }) => { +const requestLogger = createMiddleware().handler(async ({ next, request }) => { const startTime = Date.now() const timestamp = new Date().toISOString() console.log(`[${timestamp}] ${request.method} ${request.url} - Starting`)
126-136: Add missing imports in route snippet using json/createFileRoute.
jsonandcreateFileRouteare used but not imported in this snippet.Apply the import additions in the same snippet as shown in the previous diff (lines 100-113).
docs/router/integrations/query.md (2)
127-132: Bug:contextis undefined in loader example
contextis referenced but not destructured from the loader args.Apply:
-export const Route = createFileRoute('/user/$id')({ - loader: ({ params }) => { - // do not await this nor return the promise, just kick off the query to stream it to the client - context.queryClient.fetchQuery(userQuery(params.id)) - }, -}) +export const Route = createFileRoute('/user/$id')({ + loader: ({ params, context }) => { + // do not await this nor return the promise; kick off the query to stream to the client + void context.queryClient.fetchQuery(userQuery(params.id)) + }, +})
6-8: Correct broken docs link
In docs/router/integrations/query.md (line 7), update the link from
../../framework/react/guide/external-data-loading.md
to
../framework/react/guide/external-data-loading.md
🧹 Nitpick comments (7)
docs/start/framework/react/authentication.md (2)
8-9: Use docs-root-relative internal link per guidelines.Replace
../authentication-overview.mdwith a link relative to the docs/ root.Apply this diff:
-> **📋 Before You Start:** Check our [Authentication Overview](../authentication-overview.md) for all available options including partner solutions and hosted services. +> **📋 Before You Start:** Check our [Authentication Overview](./start/framework/authentication-overview.md) for all available options including partner solutions and hosted services.Please verify the correct target path under docs/ and adjust if the actual file lives elsewhere.
609-609: Use relative docs link for How-to Guides
Replace the absolute site path with a docs-relative link:- see the [How-to Guides](/router/latest/docs/framework/react/how-to/README.md#authentication) + see the [How-to Guides](./router/framework/react/how-to/README.md#authentication)docs/router/integrations/query.md (1)
118-120: Remove unused import in snippet
useQueryisn’t used in this example.-import { queryOptions, useQuery } from '@tanstack/react-query' +import { queryOptions } from '@tanstack/react-query'packages/react-start/src/default-entry/server.ts (1)
10-14: Add the same ESLint suppression as Solid to avoid lint failures.Solid adds the no-unnecessary-type-assertion suppression above the fetch cast; React file omits it. Add for parity and to keep DTS shaping stable without tripping ESLint.
export default { // Providing `RequestHandler` from `@tanstack/react-start/server` is required so that the output types don't import it from `@tanstack/start-server-core` - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion fetch: fetch as RequestHandler<Register>, }packages/start-client-core/src/client/hydrateStart.ts (1)
13-20: Minor: simplify initialization and avoid overriding defaults when absent.Use nullish assignment and only set defaultSsr if provided.
- const startOptions = await startInstance.getOptions() - startOptions.serializationAdapters = - startOptions.serializationAdapters ?? [] + const startOptions = await startInstance.getOptions() + startOptions.serializationAdapters ??= [] window.__TSS_START_OPTIONS__ = startOptions as AnyStartInstanceOptions serializationAdapters = startOptions.serializationAdapters - router.options.defaultSsr = startOptions.defaultSsr + if (startOptions.defaultSsr !== undefined) { + router.options.defaultSsr = startOptions.defaultSsr + }packages/router-plugin/src/core/code-splitter/compilers.ts (1)
167-180: Non-null assertion is safe under the preceding guard; consider tiny cleanup.Given the size > 0 check, opts.deleteNodes!.has(...) is safe. For readability, hoist a local const to avoid the bang.
- if (opts.deleteNodes && opts.deleteNodes.size > 0) { + if (opts.deleteNodes && opts.deleteNodes.size > 0) { + const deleteNodes = opts.deleteNodes routeOptions.properties = routeOptions.properties.filter( (prop) => { if (t.isObjectProperty(prop)) { if (t.isIdentifier(prop.key)) { - if (opts.deleteNodes!.has(prop.key.name as any)) { + if (deleteNodes.has(prop.key.name as any)) { return false } } } return true }, ) }packages/start-plugin-core/src/start-compiler-plugin/plugin.ts (1)
63-81: Safer resolution for optional packages and keep filters resilient across environments.Current unconditional resolvePackage(...) can throw if a package isn’t installed in a consumer setup. Wrap resolves to avoid hard failures while still excluding when present.
Apply this diff within the selected block to use a safe resolver:
- ...makeIdFiltersToMatchWithQuery([ - ...resolveRuntimeFiles({ + ...makeIdFiltersToMatchWithQuery([ + ...safeResolveRuntimeFiles({ package: '@tanstack/start-client-core', files: [ 'index.js', 'createIsomorphicFn.js', 'envOnly.js', 'serverFnFetcher.js', ], }), - ...resolveRuntimeFiles({ + ...safeResolveRuntimeFiles({ package: '@tanstack/start-server-core', files: ['index.js', 'server-functions-handler.js'], }), - ...resolveRuntimeFiles({ + ...safeResolveRuntimeFiles({ package: `@tanstack/${framework}-start-client`, files: ['index.js'], }), ]),Add this helper near resolveRuntimeFiles for graceful fallback:
function safeResolveRuntimeFiles(opts: { package: string; files: Array<string> }) { try { return resolveRuntimeFiles(opts) } catch { return [] } }
- Confirm that narrowing the excluded files (dropping createServerFn.js, createMiddleware.js, serverRoute.js, etc.) is intentional and covered by tests (no unintended transforms of runtime internals).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
- pnpm-lock.yamlis excluded by- !**/pnpm-lock.yaml
📒 Files selected for processing (14)
- docs/router/integrations/query.md(2 hunks)
- docs/start/framework/react/authentication.md(7 hunks)
- docs/start/framework/react/observability.md(2 hunks)
- packages/react-start/src/default-entry/server.ts(1 hunks)
- packages/react-start/src/default-entry/start.ts(1 hunks)
- packages/react-start/vite.config.server-entry.ts(1 hunks)
- packages/router-plugin/src/core/code-splitter/compilers.ts(1 hunks)
- packages/router-plugin/src/core/router-code-splitter-plugin.ts(1 hunks)
- packages/solid-start/src/default-entry/server.ts(1 hunks)
- packages/solid-start/src/default-entry/start.ts(1 hunks)
- packages/solid-start/vite.config.server-entry.ts(1 hunks)
- packages/start-client-core/src/client/hydrateStart.ts(1 hunks)
- packages/start-plugin-core/package.json(1 hunks)
- packages/start-plugin-core/src/start-compiler-plugin/plugin.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Use internal docs links relative to the docs/ folder (e.g., ./guide/data-loading)
Files:
- docs/start/framework/react/observability.md
- docs/router/integrations/query.md
- docs/start/framework/react/authentication.md
docs/{router,start}/**
📄 CodeRabbit inference engine (AGENTS.md)
Place router docs under docs/router/ and start framework docs under docs/start/
Files:
- docs/start/framework/react/observability.md
- docs/router/integrations/query.md
- docs/start/framework/react/authentication.md
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
- packages/react-start/src/default-entry/start.ts
- packages/react-start/vite.config.server-entry.ts
- packages/solid-start/vite.config.server-entry.ts
- packages/router-plugin/src/core/router-code-splitter-plugin.ts
- packages/solid-start/src/default-entry/start.ts
- packages/router-plugin/src/core/code-splitter/compilers.ts
- packages/solid-start/src/default-entry/server.ts
- packages/start-client-core/src/client/hydrateStart.ts
- packages/react-start/src/default-entry/server.ts
- packages/start-plugin-core/src/start-compiler-plugin/plugin.ts
packages/{*-start,start-*}/**
📄 CodeRabbit inference engine (AGENTS.md)
Name and place Start framework packages under packages/-start/ or packages/start-/
Files:
- packages/react-start/src/default-entry/start.ts
- packages/react-start/vite.config.server-entry.ts
- packages/solid-start/vite.config.server-entry.ts
- packages/solid-start/src/default-entry/start.ts
- packages/solid-start/src/default-entry/server.ts
- packages/start-client-core/src/client/hydrateStart.ts
- packages/react-start/src/default-entry/server.ts
- packages/start-plugin-core/src/start-compiler-plugin/plugin.ts
- packages/start-plugin-core/package.json
packages/{router-cli,router-generator,router-plugin,virtual-file-routes}/**
📄 CodeRabbit inference engine (AGENTS.md)
Keep CLI, generators, bundler plugins, and virtual file routing utilities in their dedicated tooling package directories
Files:
- packages/router-plugin/src/core/router-code-splitter-plugin.ts
- packages/router-plugin/src/core/code-splitter/compilers.ts
packages/router-plugin/**
📄 CodeRabbit inference engine (AGENTS.md)
Use unplugin for universal bundler plugins in the router-plugin package
Files:
- packages/router-plugin/src/core/router-code-splitter-plugin.ts
- packages/router-plugin/src/core/code-splitter/compilers.ts
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Use workspace:* protocol for internal dependencies in package.json files
Files:
- packages/start-plugin-core/package.json
🧠 Learnings (2)
📚 Learning: 2025-09-23T17:36:12.589Z
Learnt from: CR
PR: TanStack/router#0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.589Z
Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/
Applied to files:
- packages/react-start/src/default-entry/server.ts
📚 Learning: 2025-09-23T17:36:12.589Z
Learnt from: CR
PR: TanStack/router#0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.589Z
Learning: Applies to packages/router-plugin/** : Use unplugin for universal bundler plugins in the router-plugin package
Applied to files:
- packages/start-plugin-core/package.json
🧬 Code graph analysis (2)
packages/react-start/src/default-entry/start.ts (1)
packages/solid-start/src/default-entry/start.ts (1)
startInstance(1-1)
packages/solid-start/src/default-entry/start.ts (1)
packages/react-start/src/default-entry/start.ts (1)
startInstance(1-1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
🔇 Additional comments (14)
docs/start/framework/react/observability.md (2)
520-523: Rename to inputValidator looks correct (OpenTelemetry example).The validation and handler data destructuring align.
64-66: Rename to inputValidator looks correct.
The builder chain and handler signature remain consistent.
No.validator(usages found in.md/.mdxdocs.docs/start/framework/react/authentication.md (1)
50-51: No stale.validatorreferences remain. All examples now consistently use.inputValidator(...)with the correct handler signature.docs/router/integrations/query.md (3)
41-60: Approve rename togetRouter— verified all docs referencegetRouter(), no instances ofcreateAppRouter.
21-28: Install as a runtime dependency — LGTMNo other docs reference dev installs for
@tanstack/react-router-ssr-query.
36-39: Verified SSR query integration API exports:@tanstack/react-router-ssr-queryexportssetupRouterSsrQueryIntegrationwith optionsrouter,queryClient,handleRedirects?, andwrapQueryClient?.packages/react-start/src/default-entry/server.ts (1)
5-5: Register type source change looks correct; verify version alignment.Switching Register to come from @tanstack/react-router matches the Solid variant and likely the intended public source. Please confirm package/peer versions are aligned to avoid DTS drift.
packages/react-start/vite.config.server-entry.ts (1)
7-7: Removing '#tanstack-start-entry' from externals looks good.Matches the broader migration to a named startInstance import. Please confirm server-entry builds don’t reference the virtual module anymore.
packages/solid-start/src/default-entry/server.ts (1)
12-13: Good: ESLint suppression aligns with intended DTS cast.Parity with React entry is recommended (React file currently lacks this line).
packages/solid-start/vite.config.server-entry.ts (1)
7-7: LGTM on externalDeps trim.Consistent with the startInstance named export approach.
packages/start-client-core/src/client/hydrateStart.ts (1)
6-6: Named import switch is correct given the new entry surface.Assuming the start entry module resolves, this aligns with the new export shape.
packages/router-plugin/src/core/router-code-splitter-plugin.ts (1)
134-136: Passing Set or undefined for deleteNodes is correct; consistent with downstream non-null assertions.This aligns with the guard in compilers.ts that checks size before calling .has. No action needed.
Please confirm that userConfig.codeSplittingOptions?.deleteNodes is typed as Array to ensure Set construction is type-safe.
packages/start-plugin-core/src/start-compiler-plugin/plugin.ts (1)
8-8: Import of makeIdFiltersToMatchWithQuery is appropriate for query-aware ID matching.Good improvement to handle id queries (e.g., ?v=...).
Please verify cross-bundler support: that Unplugin’s transform.filter id exclude array accepts the filter objects produced by @rolldown/pluginutils in Vite, Webpack, and Rspack environments.
packages/start-plugin-core/package.json (1)
67-67: Confirm @rolldown/pluginutils version publishing
The dependency is pinned to 1.0.0-beta.40 but npm only publishes up to 1.0.0-beta.34 (which does export makeIdFiltersToMatchWithQuery). Ensure 1.0.0-beta.40 is available on your registry or revert the version to 1.0.0-beta.34.
| @@ -1 +1 @@ | |||
| export default {} | |||
| export const startInstance = undefined | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typing issue: exported startInstance is undefined, breaking downstream type narrowing.
With export const startInstance = undefined, the type is undefined, making if (startInstance) { await startInstance.getOptions() } unreachable/invalid in consumers (e.g., hydrateStart.ts). Export a union with a minimal shape to satisfy usage.
-export const startInstance = undefined
+export type StartInstanceShim = {
+  getOptions: () => Promise<unknown>
+}
+export const startInstance: StartInstanceShim | undefined = undefined📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export const startInstance = undefined | |
| export type StartInstanceShim = { | |
| getOptions: () => Promise<unknown> | |
| } | |
| export const startInstance: StartInstanceShim | undefined = undefined | 
🤖 Prompt for AI Agents
In packages/react-start/src/default-entry/start.ts around line 1, the file
currently exports startInstance as the literal value undefined which gives it
the type undefined and breaks downstream type-narrowing; change this to export a
typed union so consumers can narrow safely: declare a minimal interface/type
that matches expected usage (at least a getOptions method returning a Promise or
appropriate signature used by hydrateStart.ts), then export startInstance with
that interface unioned with undefined (e.g., MyStartInstance | undefined) and
initialize it to undefined so runtime value remains the same but TypeScript sees
the correct shape for conditional checks.
| @@ -1 +1 @@ | |||
| export default {} | |||
| export const startInstance = undefined | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same typing issue as React: startInstance must not be undefined-only.
Expose a union with a minimal method contract so downstream getOptions() compiles.
-export const startInstance = undefined
+export type StartInstanceShim = {
+  getOptions: () => Promise<unknown>
+}
+export const startInstance: StartInstanceShim | undefined = undefined📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export const startInstance = undefined | |
| export type StartInstanceShim = { | |
| getOptions: () => Promise<unknown> | |
| } | |
| export const startInstance: StartInstanceShim | undefined = undefined | 
🤖 Prompt for AI Agents
In packages/solid-start/src/default-entry/start.ts around line 1, the exported
startInstance is currently undefined-only which breaks downstream typing for
getOptions; change the export to a union type exposing a minimal method contract
(e.g. an object shape that includes the getOptions signature used downstream) so
startInstance can be either that object or undefined, update the exported
declaration accordingly, and ensure the declared getOptions parameter and return
types match the expectations in downstream code so compilation succeeds.
Summary by CodeRabbit