Skip to content

fix(solid-router): respect wrapInSuspense - #7898

Open
xianjianlf2 wants to merge 1 commit into
TanStack:mainfrom
xianjianlf2:fix/solid-wrap-in-suspense-7829
Open

fix(solid-router): respect wrapInSuspense#7898
xianjianlf2 wants to merge 1 commit into
TanStack:mainfrom
xianjianlf2:fix/solid-wrap-in-suspense-7829

Conversation

@xianjianlf2

@xianjianlf2 xianjianlf2 commented Jul 25, 2026

Copy link
Copy Markdown

Fixes #7829.

Solid Router always rendered matches inside Solid.Suspense, so wrapInSuspense: false did not prevent a route pending component from being used as the suspense fallback. This keeps the existing default behavior, but switches to SafeFragment when a route explicitly opts out.

I added a regression test for a pending child route with wrapInSuspense: false and an unresolved loader, while preserving the existing root pending component behavior.

Tests run:

  • PATH=/opt/homebrew/bin:$PATH pnpm --dir packages/solid-router exec vitest run tests/Matches.test.tsx --reporter=dot
  • PATH=/opt/homebrew/bin:$PATH pnpm --dir packages/solid-router test:types:ts70
  • PATH=/opt/homebrew/bin:$PATH pnpm --dir packages/solid-router test:eslint
  • PATH=/opt/homebrew/bin:$PATH pnpm exec prettier --check packages/solid-router/src/Match.tsx packages/solid-router/tests/Matches.test.tsx

Summary by CodeRabbit

  • New Features

    • Added support for disabling suspense boundaries on individual routes.
    • Routes configured without suspense now transition directly to their resolved content without displaying a pending component.
  • Bug Fixes

    • Improved suspense handling based on route and router configuration, preventing unnecessary pending UI when suspense is disabled.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cdc6a983-834e-4491-a746-cc3fb57049f3

📥 Commits

Reviewing files that changed from the base of the PR and between 88f366a and 3896f15.

📒 Files selected for processing (2)
  • packages/solid-router/src/Match.tsx
  • packages/solid-router/tests/Matches.test.tsx

📝 Walkthrough

Walkthrough

Solid Router’s Match component now respects wrapInSuspense and related pending-state conditions when selecting suspense boundaries. A test verifies that disabled suspense omits the pending component while an asynchronous route loader is pending.

Changes

Solid Router suspense handling

Layer / File(s) Summary
Conditional suspense boundary behavior
packages/solid-router/src/Match.tsx, packages/solid-router/tests/Matches.test.tsx
ResolvedSuspenseBoundary now chooses Solid.Suspense or SafeFragment based on route options and resolved state. Tests cover wrapInSuspense: false during and after a pending loader.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: package: solid-router

Suggested reviewers: sheraff

🚥 Pre-merge checks | ✅ 5
✅ 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 is concise and accurately summarizes the main change to respect wrapInSuspense.
Linked Issues check ✅ Passed The Match.tsx change and regression test implement wrapInSuspense support as requested in #7829.
Out of Scope Changes check ✅ Passed The PR stays focused on wrapInSuspense behavior and its regression test, with no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

solid-router: wrapInSuspense route option is ignored

1 participant