Skip to content

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

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

fix(solid-router): respect wrapInSuspense#7898
xianjianlf2 wants to merge 3 commits 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 with suspense disabled now transition directly to resolved content without displaying a pending fallback.
    • Added dynamic handling for route loading and suspense behavior.
  • Bug Fixes

    • Prevented unnecessary pending UI from appearing while suspense-disabled routes load.

@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: 5f2c7bd0-5d36-4c5d-a713-c315c549e06c

📥 Commits

Reviewing files that changed from the base of the PR and between 8d2389d and 169cb95.

📒 Files selected for processing (1)
  • packages/solid-router/src/Match.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/solid-router/src/Match.tsx

📝 Walkthrough

Walkthrough

Solid Router’s Match component now respects wrapInSuspense when selecting suspense boundaries and rendering pending fallbacks. A test verifies disabled suspense during a pending loader and after loader resolution.

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
Match selects Solid.Suspense or SafeFragment based on route options. The pending component is omitted when wrapInSuspense is false. Tests cover pending and resolved loader states.

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

🚥 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 clearly and concisely describes the main change: making Solid Router respect the wrapInSuspense route option.
Linked Issues check ✅ Passed The implementation reads wrapInSuspense, selects SafeFragment when false, suppresses the pending fallback, and adds a regression test for issue #7829.
Out of Scope Changes check ✅ Passed The changes are limited to Match.tsx behavior and its regression test, which directly support the linked issue and PR objectives.
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.

…pense-7829

# Conflicts:
#	packages/solid-router/src/Match.tsx
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@xianjianlf2

Copy link
Copy Markdown
Author

Merged latest origin/main into fix/solid-wrap-in-suspense-7829 and resolved the Solid Match.tsx refactor conflict by porting wrapInSuspense: false onto the new MatchContent structure.

Validation:

  • pnpm install --frozen-lockfile
  • pnpm exec prettier --check packages/solid-router/src/Match.tsx packages/solid-router/tests/Matches.test.tsx
  • pnpm --dir packages/history run build
  • pnpm --dir packages/router-core run build
  • pnpm --dir packages/solid-router exec vitest run tests/Matches.test.tsx (27 passed, no type errors)

Current head: 8d2389d3befc5c2902cb5b7e72ce945734184bbd

…pense-7829

# Conflicts:
#	packages/solid-router/src/Match.tsx
@xianjianlf2

Copy link
Copy Markdown
Author

Synced this branch with latest origin/main and resolved the packages/solid-router/src/Match.tsx conflict by keeping the wrapInSuspense=false SafeFragment boundary behavior while preserving upstream’s development-only pendingComponent non-route-context wrapping.

Validation:

  • pnpm prettier --check packages/solid-router/src/Match.tsx
  • pnpm --dir packages/solid-router exec vitest run tests/Matches.test.tsx tests/Outlet.test.tsx (31 passed, type errors: no errors)
  • pnpm --dir packages/solid-router exec tsc -p tsconfig.json --noEmit
  • git diff --check

Notes:

  • pnpm --dir packages/solid-router exec vitest run --mode server tests/Matches.test.tsx tests/Outlet.test.tsx did not match server-mode test files for these filters.
  • pnpm exec eslint packages/solid-router/src/Match.tsx still reports existing type-aware no-unnecessary-condition issues elsewhere in the file, outside the conflict resolution.

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