Skip to content
Source
Sign inSign up
TanStack/router

[feat]: Add stable IDs for server functions #7693

OpenLadyBluenotes(GitHub profile, opens in a new tab)wants to merge 30 commits intomain fromstable-serverfn-ids-2opened

Summary by CodeRabbit

  • New Features
    • Added optional support for manually providing a custom id when creating server functions for stable identifier-based runtime lookup, including through chaining and locally named re-exports.
  • Bug Fixes
    • Improved server-function ID reservation, deduping, and lifecycle across recompilations (including HMR) to prevent stale/duplicate IDs.
    • Detects and rejects computed or non-statically analyzable id shapes, and enforces collision rules for manual/manual and manual/generated cases.
  • Documentation
    • Added a guide for manual server function IDs, including collision behavior and security caveats.
  • Tests
    • Expanded type-level and compiler/runtime coverage for manual IDs, collisions, and invalidation/reuse behavior.
    1. Review Change Stack

      Note

      Reviews paused

      It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

      • Last reviewed commit: b96a0c650d3a6530f4d7e7a5023dfb69af554bd0
      • Latest commit, not reviewed: f4b60a3846160437b493772fb3a0a210b1ad7dce

      Use the following commands to manage reviews:

      • @coderabbitai resume to resume automatic reviews.
      • @coderabbitai review to trigger a single review.

      Use the checkboxes below for quick actions:

      • ▶️ Resume reviews
      • 🔍 Trigger review
      Walkthrough

      This PR adds optional id support to createServerFn and threads explicit server-function IDs through compiler reservation, invalidation cleanup, docs, and tests.

      Changes

      Manual server-function ID reservation

      Layer / File(s)Summary
      Public id option surface
      packages/start-client-core/src/createServerFn.ts, packages/start-client-core/src/tests/createServerFn.test-d.ts, packages/start-plugin-core/src/start-compiler/types.ts
      createServerFn option types gain optional id?: string, CompilationContext gains reserveFunctionId, and the type test asserts a createServerFn({ id }) call exposes handler.
      Compiler reservation lifecycle
      packages/start-plugin-core/src/start-compiler/compiler.ts
      StartCompiler tracks reserved manual IDs, updates ID generation and deduplication, clears reservations on module invalidation, and exposes the new context handler.
      Manual id extraction and handler wiring
      packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      handleCreateServerFn extracts static id options, validates the format, and reserves explicit IDs when present.
      ID behavior tests and docs
      packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts, docs/start/framework/react/guide/server-functions.md
      The plugin tests cover manual ID extraction, unsupported computed keys, generated ID collisions, reserved-ID reuse and release, dev-mode encoding, and the docs describe manual server-function IDs and collision rules.

      Estimated code review effort

      🎯 4 (Complex) | ⏱️ ~60 minutes

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring 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 (4 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe title clearly matches the main change: adding stable/manual IDs for server functions.
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `stable-serverfn-ids-2`
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core

    3. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-client-core

    4. View your CI Pipeline Execution ↗ for commit f4b60a3846160437b493772fb3a0a210b1ad7dce

      CommandStatusDurationResult
      nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 26sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-24 21:56:03 UTC

    5. 🚀 Changeset Version Preview

      2 package(s) bumped directly, 12 bumped as dependents.

      🟨 Minor bumps

      PackageVersionReason
      @tanstack/start-client-core1.170.39 → 1.171.0Changeset
      @tanstack/start-plugin-core1.171.55 → 1.172.0Changeset

      🟩 Patch bumps

      PackageVersionReason
      @tanstack/react-start1.169.4 → 1.169.5Dependent
      @tanstack/react-start-client1.168.44 → 1.168.45Dependent
      @tanstack/react-start-rsc0.1.65 → 0.1.66Dependent
      @tanstack/react-start-server1.167.52 → 1.167.53Dependent
      @tanstack/solid-start1.169.4 → 1.169.5Dependent
      @tanstack/solid-start-client1.168.42 → 1.168.43Dependent
      @tanstack/solid-start-server1.167.50 → 1.167.51Dependent
      @tanstack/start-server-core1.169.45 → 1.169.46Dependent
      @tanstack/start-static-server-functions1.167.44 → 1.167.45Dependent
      @tanstack/vue-start1.169.4 → 1.169.5Dependent
      @tanstack/vue-start-client1.167.45 → 1.167.46Dependent
      @tanstack/vue-start-server1.167.50 → 1.167.51Dependent
    6. Bundle Size Benchmarks

      This pull request does not affect bundle size in any measured scenario.

    7. More templates

      @tanstack/arktype-adapter

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

      @tanstack/eslint-plugin-router

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

      @tanstack/eslint-plugin-start

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

      @tanstack/history

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

      @tanstack/react-router

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

      @tanstack/react-router-devtools

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

      @tanstack/react-router-ssr-query

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

      @tanstack/react-start

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

      @tanstack/react-start-client

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

      @tanstack/react-start-rsc

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

      @tanstack/react-start-server

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

      @tanstack/router-cli

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

      @tanstack/router-core

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

      @tanstack/router-devtools

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

      @tanstack/router-devtools-core

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

      @tanstack/router-generator

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

      @tanstack/router-plugin

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

      @tanstack/router-ssr-query-core

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

      @tanstack/router-utils

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

      @tanstack/router-vite-plugin

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

      @tanstack/solid-router

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

      @tanstack/solid-router-devtools

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

      @tanstack/solid-router-ssr-query

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

      @tanstack/solid-start

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

      @tanstack/solid-start-client

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

      @tanstack/solid-start-server

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

      @tanstack/start-client-core

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

      @tanstack/start-fn-stubs

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

      @tanstack/start-plugin-core

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

      @tanstack/start-server-core

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

      @tanstack/start-static-server-functions

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

      @tanstack/start-storage-context

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

      @tanstack/valibot-adapter

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

      @tanstack/virtual-file-routes

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

      @tanstack/vue-router

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

      @tanstack/vue-router-devtools

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

      @tanstack/vue-router-ssr-query

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

      @tanstack/vue-start

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

      @tanstack/vue-start-client

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

      @tanstack/vue-start-server

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

      @tanstack/zod-adapter

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

      commit: f4b60a3

    8. Actionable comments posted: 3

      🤖 Prompt for all review comments with AI agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      Inline comments:
      In `@packages/start-plugin-core/src/start-compiler/compiler.ts`:
      - Around line 674-689: The reserveFunctionId logic currently only checks
      reserved/generated IDs and manual owners, so a manual server function ID can
      still collide with a known server function discovered by getKnownServerFns().
      Update reserveFunctionId in compiler.ts to also consult the known
      server-function set before accepting opts.functionId, and reject any manual ID
      that matches an existing server function ID so handleCreateServerFn never reuses
      an unrelated knownFns entry.
      
      In `@packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts`:
      - Around line 184-215: Resolve static template-literal IDs in the createServerFn
      ID extraction path: handle no-expression template literals the same way as
      string literals so `resolveStaticString`-compatible values like `id:
      \`get-user\`` and `const id = \`get-user\`; createServerFn({ id })` don’t fall
      through to the generic error. Update the ID resolution logic in
      `handleCreateServerFn` (especially the branches that currently check
      `t.isStringLiteral`, `t.isIdentifier`, and `bindingInit`) to accept the static
      template-literal case and still validate it against
      `MANUAL_SERVER_FN_ID_PATTERN` before returning the resolved value.
      - Around line 227-250: The helper getCreateServerFnCallExpression only matches
      an innermost callee named createServerFn, so aliased or namespace-resolved
      factory calls are missed and manual ids are skipped. Update the resolution logic
      in getCreateServerFnCallExpression (and any related createServerFn candidate
      handling in handleCreateServerFn.ts) to unwrap aliased/namespace call chains and
      recognize the actual factory call regardless of local import name, so { id:
      "..." } is preserved instead of falling back to generated IDs.
      🪄 Autofix (Beta)

      Fix all unresolved CodeRabbit comments on this PR:

      • Push a commit to this branch (recommended)
      • Create a new PR with the fixes

      ℹ️ Review info
      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Pro

      Run ID: 01e9cb30-43da-4380-bb1e-cd0ea1f81bcd

      📥 Commits

      Reviewing files that changed from the base of the PR and between 3d86aee2640c58a045d0946e717e282b66608e1d and a8a2739a81b7e7c85590e8df8a347f08c53b961f.

      📒 Files selected for processing (6)
      • packages/start-client-core/src/createServerFn.ts
      • packages/start-client-core/src/tests/createServerFn.test-d.ts
      • packages/start-plugin-core/src/start-compiler/compiler.ts
      • packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      • packages/start-plugin-core/src/start-compiler/types.ts
      • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
      Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
    9. Merging this PR will not alter performance

      1 warning, 1 note

      :warning: 48 benchmarks are dominated by system calls

      System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

      Learn more about system calls

      See affected benchmarks

      :information_source: 20 benchmarks have no flamegraph

      The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

      See affected benchmarks

      ✅ 194 untouched benchmarks ⏩ 3 skipped benchmarks1


      Comparing stable-serverfn-ids-2 (f4b60a3) with main (6b9fe6d)[^unexpected-base] 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. ↩

    10. Important

      At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

      Nx Cloud is proposing a fix for your failed CI:

      We fixed two issues introduced by the PR's new tests and helper function: the knownServerFns fixture objects in the two new tests were missing the required filename field from the ServerFn interface, causing TypeScript compilation failures. We also tightened the currentCall variable type from t.CallExpression | undefined to t.CallExpression and replaced the always-truthy while (currentCall) with for (;;) to resolve the ESLint no-unnecessary-condition error in the newly added getCreateServerFnCallExpression helper.

      Warning

      ❌ We could not verify this fix.

      Suggested Fix changes
      diff --git a/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts b/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      index cf68578d..9a58b1b2 100644
      --- a/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      +++ b/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      @@ -159,20 +159,20 @@ function extractManualServerFnId(
             continue
           }
       
      -      if (prop.computed) {
      -        const keyValue = resolveStaticString(candidatePath, prop.key)
      +    if (prop.computed) {
      +      const keyValue = resolveStaticString(candidatePath, prop.key)
       
      -        if (keyValue === 'id') {
      -          throw codeFrameError(
      -            code,
      -            prop.loc!,
      -            'createServerFn({ [key]: value }) is not supported for manual ids.',
      -          )
      -        }
      -
      -        continue
      +      if (keyValue === 'id') {
      +        throw codeFrameError(
      +          code,
      +          prop.loc!,
      +          'createServerFn({ [key]: value }) is not supported for manual ids.',
      +        )
             }
       
      +      continue
      +    }
      +
           const isIdKey =
             (t.isIdentifier(prop.key) && prop.key.name === 'id') ||
             (t.isStringLiteral(prop.key) && prop.key.value === 'id')
      @@ -227,9 +227,9 @@ function extractManualServerFnId(
       function getCreateServerFnCallExpression(
         candidatePath: babel.NodePath<t.CallExpression>,
       ): t.CallExpression | undefined {
      -  let currentCall: t.CallExpression | undefined = candidatePath.node
      +  let currentCall: t.CallExpression = candidatePath.node
       
      -  while (currentCall) {
      +  for (;;) {
           const callee: t.CallExpression['callee'] = currentCall.callee
           if (!t.isMemberExpression(callee)) {
             return undefined
      @@ -421,7 +421,10 @@ export function handleCreateServerFn(
           }
           functionNameSet.add(functionName)
       
      -    const manualFunctionId = extractManualServerFnId(candidatePath, context.code)
      +    const manualFunctionId = extractManualServerFnId(
      +      candidatePath,
      +      context.code,
      +    )
       
           // Generate function ID using pre-computed relative filename unless the user supplied one.
           const functionId =
      diff --git a/packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts b/packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
      index 9e8158ea..173e8919 100644
      --- a/packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
      +++ b/packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
      @@ -803,6 +803,7 @@ describe('createServerFn compiles correctly', async () => {
               functionId: 'constant_id',
               extractedFilename: '/test/src/known-fn.tsx',
               functionName: 'knownFn',
      +        filename: '/test/src/known-fn.tsx',
             },
           }
       
      @@ -841,6 +842,7 @@ describe('createServerFn compiles correctly', async () => {
               functionId: 'constant_id',
               extractedFilename: '/test/src/new-fn.tsx?tss-serverfn-split',
               functionName: 'greetUser_createServerFn_handler',
      +        filename: '/test/src/new-fn.tsx',
             },
           }
       
      @@ -942,9 +944,9 @@ describe('createServerFn compiles correctly', async () => {
           })
       
           expect(firstResult!.code).toContain('createSsrRpc("get-user")')
      -    expect(compiler.invalidateModule('/test/src/submit-post-formdata.tsx')).toBe(
      -      true,
      -    )
      +    expect(
      +      compiler.invalidateModule('/test/src/submit-post-formdata.tsx'),
      +    ).toBe(true)
       
           const secondResult = await compiler.compile({
             code: source,
      

      Apply fix via Nx Cloud  Reject fix via Nx Cloud


      Or Apply changes locally with:

      npx nx-cloud apply-locally ox9A-RVf8
      Apply fix locally with your editor ↗   View interactive diff ↗

      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    11. github-actions[bot](GitHub profile, opens in a new tab) added labelsdocumentation

    12. Important

      At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

      Nx Cloud is proposing a fix for your failed CI:

      We fix two type-level errors introduced by the new manual server function ID feature. A t.isExpression() guard is added before passing prop.value to resolveStaticString, resolving a TS2345 mismatch where Babel's ObjectProperty.value can include PatternLike nodes not accepted by the function's Expression | PrivateName signature. The always-truthy while (currentCall) loop condition is replaced with while (true), resolving the @typescript-eslint/no-unnecessary-condition ESLint error since currentCall is always a non-nullable t.CallExpression and all loop exits are via explicit return statements.

      Note

      ⏳ We are verifying this fix by re-running a subset of the 3 failed tasks that were analyzed.

      diff --git a/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts b/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      index db6074db..11cf876d 100644
      --- a/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      +++ b/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      @@ -181,7 +181,9 @@ function extractManualServerFnId(
             continue
           }
       
      -    const idValue = resolveStaticString(candidatePath, prop.value)
      +    const idValue = t.isExpression(prop.value)
      +      ? resolveStaticString(candidatePath, prop.value)
      +      : undefined
       
           if (idValue !== undefined) {
             if (!MANUAL_SERVER_FN_ID_PATTERN.test(idValue)) {
      @@ -211,7 +213,7 @@ function getCreateServerFnCallExpression(
         let currentCall: t.CallExpression | undefined = candidatePath.node
         let sawMethodChain = false
       
      -  while (currentCall) {
      +  while (true) {
           const callee: t.CallExpression['callee'] = currentCall.callee
           if (!t.isMemberExpression(callee)) {
             return sawMethodChain ? currentCall : undefined
      

      Apply fix via Nx Cloud  Reject fix via Nx Cloud


      Or Apply changes locally with:

      npx nx-cloud apply-locally NZeR-Henn
      Apply fix locally with your editor ↗   View interactive diff ↗

      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    13. Important

      At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

      Nx Cloud is proposing a fix for your failed CI:

      We updated getCreateServerFnCallExpression in handleCreateServerFn.ts to replace the while (currentCall) loop condition with while (true), which fixes the @typescript-eslint/no-unnecessary-condition ESLint error. Since currentCall is initialized to a non-optional t.CallExpression and is only ever reassigned after a t.isCallExpression() guard, TypeScript correctly determines it can never be falsy, making the original condition redundant. The loop already exits exclusively via return statements, so while (true) is semantically identical and satisfies the lint rule.

      Warning

      ❌ We could not verify this fix.

      diff --git a/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts b/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      index 0d0bbb8a..be702e40 100644
      --- a/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      +++ b/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      @@ -219,7 +219,7 @@ function getCreateServerFnCallExpression(
         let currentCall: t.CallExpression | undefined = candidatePath.node
         let sawMethodChain = false
       
      -  while (currentCall) {
      +  while (true) {
           const callee: t.CallExpression['callee'] = currentCall.callee
           if (!t.isMemberExpression(callee)) {
             return sawMethodChain ? currentCall : undefined
      

      Apply fix via Nx Cloud  Reject fix via Nx Cloud


      Or Apply changes locally with:

      npx nx-cloud apply-locally bYpJ-ovcX
      Apply fix locally with your editor ↗   View interactive diff ↗

      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    14. Important

      At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

      Nx Cloud is proposing a fix for your failed CI:

      We fixed the ESLint @typescript-eslint/no-unnecessary-condition error by correcting the type and loop condition in the newly added getCreateServerFnCallExpression function. The currentCall variable was typed as t.CallExpression | undefined despite never being assigned undefined, and the while (currentCall) guard was therefore always truthy. Changing the type to t.CallExpression and the loop to while (true) accurately reflects the logic, where all exit paths are via explicit return statements.

      Tip

      ✅ We verified this fix by re-running @tanstack/start-plugin-core:test:eslint.

      diff --git a/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts b/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      index 0d0bbb8a..e587a47e 100644
      --- a/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      +++ b/packages/start-plugin-core/src/start-compiler/handleCreateServerFn.ts
      @@ -216,10 +216,10 @@ function extractManualServerFnId(
       function getCreateServerFnCallExpression(
         candidatePath: babel.NodePath<t.CallExpression>,
       ): t.CallExpression | undefined {
      -  let currentCall: t.CallExpression | undefined = candidatePath.node
      +  let currentCall: t.CallExpression = candidatePath.node
         let sawMethodChain = false
       
      -  while (currentCall) {
      +  for (;;) {
           const callee: t.CallExpression['callee'] = currentCall.callee
           if (!t.isMemberExpression(callee)) {
             return sawMethodChain ? currentCall : undefined
      @@ -237,8 +237,6 @@ function getCreateServerFnCallExpression(
           sawMethodChain = true
           currentCall = innerCall
         }
      -
      -  return undefined
       }
       
       function resolveStaticString(
      

      Apply fix via Nx Cloud  Reject fix via Nx Cloud


      Or Apply changes locally with:

      npx nx-cloud apply-locally TbLk-kNAH
      Apply fix locally with your editor ↗   View interactive diff ↗

      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    15. Important

      At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

      Nx Cloud is proposing a fix for your failed CI:

      We reordered the imports in hydrateStart.ts to satisfy the import/order ESLint rule, which requires sibling and type imports to appear before the #tanstack-* virtual module imports. The three offending imports (./ServerFunctionSerializationAdapter, @tanstack/router-core type, and ../createStart type) were placed after the #tanstack-start-entry block, causing the lint task to fail. Moving them above the virtual module imports resolves all three reported errors.

      Warning

      ❌ We could not verify this fix.

      diff --git a/packages/start-client-core/src/client/hydrateStart.ts b/packages/start-client-core/src/client/hydrateStart.ts
      index 83b9c468..0f970cb9 100644
      --- a/packages/start-client-core/src/client/hydrateStart.ts
      +++ b/packages/start-client-core/src/client/hydrateStart.ts
      @@ -1,13 +1,13 @@
       import { hydrate } from '@tanstack/router-core/ssr/client'
      +import { ServerFunctionSerializationAdapter } from './ServerFunctionSerializationAdapter'
      +import type { AnyRouter, AnySerializationAdapter } from '@tanstack/router-core'
      +import type { AnyStartInstanceOptions } from '../createStart'
       import { startInstance } from '#tanstack-start-entry'
       import {
         hasPluginAdapters,
         pluginSerializationAdapters,
       } from '#tanstack-start-plugin-adapters'
       import { getRouter } from '#tanstack-router-entry'
      -import { ServerFunctionSerializationAdapter } from './ServerFunctionSerializationAdapter'
      -import type { AnyRouter, AnySerializationAdapter } from '@tanstack/router-core'
      -import type { AnyStartInstanceOptions } from '../createStart'
       
       type HotContext = {
         data?: Record<string, unknown>
      

      🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.

      Apply fix via Nx Cloud  Reject fix via Nx Cloud


      Or Apply changes locally with:

      npx nx-cloud apply-locally gmHD-TZ65
      Apply fix locally with your editor ↗   View interactive diff ↗

      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    16. Important

      At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

      Nx Cloud has identified a possible root cause for your failed CI:

      We classified this build failure as an environment issue rather than a code change. The error is a nitro/nitro-nightly package version mismatch where nitro-nightly tries to import an unexported subpath (./runtime/meta) — this occurs during Vite config loading, before any of our PR's compiler code is executed. Our PR makes no changes to dependency files, and the failing example project is not among the projects touched by this PR.

      No code changes were suggested for this issue.

      Trigger a rerun:

      Rerun CI

      Nx Cloud View detailed reasoning on Nx Cloud ↗


      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    17. Important

      At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

      Nx Cloud has identified a possible root cause for your failed CI:

      We investigated the three failing tasks and determined none are caused by this PR's changes. The failures stem from pre-existing environment issues: stale build artifacts in a dist directory, a hardcoded port conflict between two Vue e2e services, and an incompatible nitro-nightly package that doesn't export the required subpath. All failing projects are outside the scope of our touched projects, so no code changes are needed.

      No code changes were suggested for this issue.

      Trigger a rerun:

      Rerun CI

      Nx Cloud View detailed reasoning on Nx Cloud ↗


      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    18. Nx Cloud has identified a flaky task in your failed CI:

      🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.

      Nx Cloud View detailed reasoning in Nx Cloud ↗


      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    19. Important

      At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

      Nx Cloud has identified a possible root cause for your failed CI:

      We traced the failing test back to an unrelated part of the codebase and don't believe this PR caused it. The navigate() with href containing basepath test times out on client-side router navigation logic, while this PR only touches server function ID generation in start-client-core and start-plugin-core's babel compiler. Given the 0% flakiness rate rules out a simple flaky rerun, we're classifying this as a pre-existing environment issue rather than something introduced here.

      No code changes were suggested for this issue.

      Trigger a rerun:

      Rerun CI

      Nx Cloud View detailed reasoning on Nx Cloud ↗


      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    20. Nx Cloud has identified a flaky task in your failed CI:

      🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.

      Nx Cloud View detailed reasoning in Nx Cloud ↗


      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    21. Nx Cloud has identified a flaky task in your failed CI:

      🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.

      Nx Cloud View detailed reasoning in Nx Cloud ↗


      🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)
    22. 🦋 Changeset detected

      Latest commit: f4b60a3846160437b493772fb3a0a210b1ad7dce

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 14 packages
      NameType
      @tanstack/start-client-coreMinor
      @tanstack/start-plugin-coreMinor
      @tanstack/react-start-clientPatch
      @tanstack/react-start-rscPatch
      @tanstack/react-startPatch
      @tanstack/solid-start-clientPatch
      @tanstack/solid-startPatch
      @tanstack/start-server-corePatch
      @tanstack/start-static-server-functionsPatch
      @tanstack/vue-start-clientPatch
      @tanstack/vue-startPatch
      @tanstack/react-start-serverPatch
      @tanstack/solid-start-serverPatch
      @tanstack/vue-start-serverPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

Sign in to join this conversation.