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
- 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
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,Outletwraps the children in a<Suspense>block of its own, preventing mine from being used. Since I have nodefaultPendingComponentconfigured, it renders nothing.I have traced the issue to this part of the code:
router/packages/react-router/src/Match.tsx
Lines 294 to 302 in f7c74bc
Your Example Website or App
https://stackblitz.com/edit/github-s38jue?file=src%2Froutes%2F__root.tsx
Steps to Reproduce the Bug or Issue
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
Additional context
Related issue: #1049