Skip to content

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

Merged
birkskyum merged 1 commit intoTanStack:mainfrom
brenelz:fix-issue-5787
Nov 8, 2025
Merged

fix(solid-router): dont show fallback unless pendingMinMs > 0#5793
birkskyum merged 1 commit intoTanStack:mainfrom
brenelz:fix-issue-5787

Conversation

@brenelz
Copy link
Contributor

@brenelz brenelz commented Nov 8, 2025

Closes #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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 8, 2025

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.

Possibly related PRs

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 name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The 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 ✅ Passed The 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 ✅ Passed The 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 ✅ Passed No 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 509f14b and 2a2741f.

📒 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.

@nx-cloud
Copy link

nx-cloud bot commented Nov 8, 2025

View your CI Pipeline Execution ↗ for commit 2a2741f

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

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 8, 2025

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

@birkskyum birkskyum merged commit 01e0f5a into TanStack:main Nov 8, 2025
6 checks passed
roduyemi pushed a commit to roduyemi/oss-router that referenced this pull request Nov 19, 2025
naoya7076 pushed a commit to naoya7076/router that referenced this pull request Feb 15, 2026
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.

Solid Start: beforeLoad with ssr: false and a pendingComponent leads to hydration mismatch

2 participants