Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions packages/react-router/src/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,16 @@ export const Outlet = React.memo(function OutletImpl() {

const nextMatch = <Match matchId={childMatchId} />

const pendingElement = router.options.defaultPendingComponent ? (
<router.options.defaultPendingComponent />
) : null

if (matchId === rootRouteId) {
return (
<React.Suspense fallback={pendingElement}>{nextMatch}</React.Suspense>
)
const PendingComponent =
route.options.pendingComponent ?? router.options.defaultPendingComponent
if (PendingComponent !== undefined) {
return (
<React.Suspense fallback={<PendingComponent />}>
{nextMatch}
</React.Suspense>
)
}
}

return nextMatch
Expand Down