Skip to content
Source
Sign inSign up
TanStack/router

fix(solid-router): dont show fallback unless pendingMinMs > 0 #5793

Mergedbrenelz(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/5793/headmerged by birkskyum(GitHub profile, opens in a new tab)

Closes https://github.com/TanStack/router/issues/5787

Summary by CodeRabbit

  • Bug Fixes
    • Refined fallback component rendering to only display when a minimum pending duration threshold is configured, improving loading state visibility.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: solid-router

    2. Walkthrough

      The FallbackComponent rendering in MatchInner is now conditional on both its existence and a minimum pending duration threshold (pendingMinMs > 0). This prevents fallback rendering when no minimum duration is configured, fixing hydration mismatches in SSR-disabled scenarios with pending components.

      Changes

      Cohort / File(s)Change Summary
      FallbackComponent conditional rendering
      packages/solid-router/src/Match.tsx
      Gate FallbackComponent rendering by requiring both FallbackComponent existence and pendingMinMs > 0 instead of rendering whenever FallbackComponent is defined

      Estimated code review effort

      🎯 2 (Simple) | ⏱️ ~8 minutes

      • Specific area of attention: Verify the conditional logic correctly prevents fallback rendering when pendingMinMs is zero or unset, and validate the fix resolves the hydration mismatch in ssr: false scenarios without breaking existing pending component behavior.
      • #5585 — Related modification to fallback-rendering logic in Match.tsx that gates PendingComponent by server/no-SSR conditions, complementing this PR's pendingMinMs gating approach.
      • #5668 — Related restructuring of Match.tsx's suspense and outlet handling that may intersect with this PR's control-flow changes.

      Suggested reviewers

      • birkskyum
      • schiller-manuel

      Poem

      🐰 A pending dance that waits so long, But when the timer sings its song, Only then the fallback shows— No hydration woes, no discord flows! Fixed at last, the SSR's friend, Where server and client beautifully blend. ✨

      Pre-merge checks and finishing touches

      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe title clearly and concisely describes the main fix: preventing fallback component rendering unless pendingMinMs is greater than 0, which directly addresses the hydration mismatch issue.
      Linked Issues check✅ PassedThe code change directly addresses issue #5787 by preventing the fallback component from rendering during SSR when no pending duration is configured, which resolves the hydration mismatch caused by mismatched content between server and client.
      Out of Scope Changes check✅ PassedThe change is narrowly focused on the fallback rendering condition in MatchInner component within Match.tsx, which is directly related to the hydration mismatch issue and contains no unrelated modifications.
      Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
      ✨ Finishing touches
      • 📝 Generate docstrings
        🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment

      📜 Recent review details

      Configuration used: CodeRabbit UI

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between 509f14b5343a1ae2cbf1f28f73cab37270f03a81 and 2a2741f3b895eedb27fe88888980421a81b3a193.

      📒 Files selected for processing (1)
      • packages/solid-router/src/Match.tsx (1 hunks)
      🧰 Additional context used
      📓 Path-based instructions (2)
      **/*.{ts,tsx}

      📄 CodeRabbit inference engine (AGENTS.md)

      Use TypeScript in strict mode with extensive type safety across the codebase

      Files:

      • packages/solid-router/src/Match.tsx
      packages/{react-router,solid-router}/**

      📄 CodeRabbit inference engine (AGENTS.md)

      Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/

      Files:

      • packages/solid-router/src/Match.tsx
      🧠 Learnings (2)
      📓 Common learnings
      Learnt from: CR
      Repo: TanStack/router PR: 0
      File: AGENTS.md:0-0
      Timestamp: 2025-09-23T17:36:12.598Z
      Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/
      Learnt from: schiller-manuel
      Repo: TanStack/router PR: 5330
      File: packages/router-core/src/router.ts:2231-2245
      Timestamp: 2025-10-01T18:30:26.591Z
      Learning: In `packages/router-core/src/router.ts`, the `resolveRedirect` method intentionally strips the router's origin from redirect URLs when they match (e.g., `https://foo.com/bar` → `/bar` for same-origin redirects) while preserving the full URL for cross-origin redirects. This logic should not be removed or simplified to use `location.publicHref` directly.
      📚 Learning: 2025-09-23T17:36:12.598Z
      Learnt from: CR
      Repo: TanStack/router PR: 0
      File: AGENTS.md:0-0
      Timestamp: 2025-09-23T17:36:12.598Z
      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/solid-router/src/Match.tsx
      ⏰ 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 (1)
      packages/solid-router/src/Match.tsx (1)

      299-301: Verify this fix is intentionally global and not inadvertently over-broad.

      While this resolves the hydration mismatch for ssr: false routes, the condition now applies globally—requiring pendingMinMs > 0 for ANY pending component to display. Since defaultPendingMinMs defaults to 500, this currently works in practice, but represents a semantic shift.

      Consider whether this should be targeted specifically to ssr: false routes instead. The variable resolvedNoSsr is available at line 63 and could gate the check more narrowly:

      {FallbackComponent && (!resolvedNoSsr || pendingMinMs > 0) ? (

      This approach would:

      • Preserve old behavior for ssr: true (always show fallback if it exists)
      • Apply the guard only to ssr: false (where the hydration mismatch occurs)

      If the global behavior change is intentional, document this as a breaking change affecting all pending component rendering logic.


      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.
    3. View your CI Pipeline Execution ↗ for commit 2a2741f3b895eedb27fe88888980421a81b3a193

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded9m 2sView ↗
      nx run-many --target=build --exclude=examples/*...✅ Succeeded30sView ↗

      ☁️ Nx Cloud last updated this comment at 2025-11-08 02:19:35 UTC

    4. More templates

      @tanstack/arktype-adapter

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

      @tanstack/directive-functions-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5793

      @tanstack/eslint-plugin-router

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

      @tanstack/history

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

      @tanstack/nitro-v2-vite-plugin

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

      @tanstack/react-router

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

      @tanstack/react-router-devtools

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

      @tanstack/react-router-ssr-query

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

      @tanstack/react-start

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

      @tanstack/react-start-client

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

      @tanstack/react-start-server

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

      @tanstack/router-cli

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

      @tanstack/router-core

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

      @tanstack/router-devtools

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

      @tanstack/router-devtools-core

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

      @tanstack/router-generator

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

      @tanstack/router-plugin

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

      @tanstack/router-ssr-query-core

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

      @tanstack/router-utils

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

      @tanstack/router-vite-plugin

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

      @tanstack/server-functions-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5793

      @tanstack/solid-router

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

      @tanstack/solid-router-devtools

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

      @tanstack/solid-router-ssr-query

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

      @tanstack/solid-start

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

      @tanstack/solid-start-client

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

      @tanstack/solid-start-server

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

      @tanstack/start-client-core

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

      @tanstack/start-plugin-core

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

      @tanstack/start-server-core

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

      @tanstack/start-static-server-functions

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

      @tanstack/start-storage-context

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

      @tanstack/valibot-adapter

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

      @tanstack/virtual-file-routes

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

      @tanstack/zod-adapter

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

      commit: 2a2741f

    5. birkskyum(GitHub profile, opens in a new tab) approved these changes

Sign in to join this conversation.