Skip to content

Outlet in root route prevents suspense from bubbling up #2026

Description

@lukasgeiter

Describe the bug

I would like to use my own loading component at the root level. To do that I'm wrapping the <Outlet> in the root component with a <Suspense> block. Unfortunately, Outlet wraps the children in a <Suspense> block of its own, preventing mine from being used. Since I have no defaultPendingComponent configured, it renders nothing.

I have traced the issue to this part of the code:

const pendingElement = router.options.defaultPendingComponent ? (
<router.options.defaultPendingComponent />
) : null
if (matchId === rootRouteId) {
return (
<React.Suspense fallback={pendingElement}>{nextMatch}</React.Suspense>
)
}

Your Example Website or App

https://stackblitz.com/edit/github-s38jue?file=src%2Froutes%2F__root.tsx

Steps to Reproduce the Bug or Issue

  1. Run the Stackblitz

Expected behavior

As a user, I expect to see the fallback content Suspense fallback - I expect this to show up, but I'm seeing nothing (besides the navigation)

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Arc (Chrome)
  • Version: 1.52.0 (51895)

Additional context

Related issue: #1049

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions