Skip to content

solid-router: wrapInSuspense route option is ignored #7829

Description

@teidesu

Which project does this relate to?

Router

Describe the bug

wrapInSuspense is declared in router-core's shared route options, so it typechecks in both adapters, but only react-router actually implements it

react-router - match only gets a Suspense boundary when it needs one, and wrapInSuspense can force it either way:

const ResolvedSuspenseBoundary =
// If we're on the root route, allow forcefully wrapping in suspense
(!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) &&
(route.options.wrapInSuspense ??
PendingComponent ??
((route.options.errorComponent as any)?.preload || resolvedNoSsr))
? React.Suspense
: SafeFragment

solid-router - unconditional, route.options.wrapInSuspense is never read anywhere in the package:

const ResolvedSuspenseBoundary = () => Solid.Suspense

proposed fix

port the react-router condition to solid-router/src/Match.tsx, something like:

const ResolvedSuspenseBoundary = () =>
  (!route().isRoot || route().options.wrapInSuspense || resolvedNoSsr) &&
  (route().options.wrapInSuspense ??
    (resolvePendingComponent() || resolvedNoSsr))
    ? Solid.Suspense
    : SafeFragment

Complete minimal reproducer

https://github.com/teidesu/tanstack-solid-router-wrapinsuspense-repro

Steps to Reproduce the Bug

  1. use wrapInSuspense: false, and add some suspenses
  2. notice how it's not respected

Expected behavior

wrapInSuspense behaves like react-router

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.170.17
  • OS: macos
  • Browser: chrome, firefox
  • Browser Version: latest
  • Bundler: vite
  • Bundler Version: 7.1.3

Additional context

this was already raised in #5855 but closed without resolution due to lack of repro. im not entirely sure what kind of repro this needs since this is a straight up missing feature, but attached one regardless

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions