From 16146caec3e748f512d4b69e8b2ac7392b8b0718 Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Tue, 13 Feb 2024 16:38:48 -0500 Subject: [PATCH] Handle scenario where there is only a root route in SPA mode --- packages/remix-react/routes.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/remix-react/routes.tsx b/packages/remix-react/routes.tsx index 22671a29f01..8975c093a27 100644 --- a/packages/remix-react/routes.tsx +++ b/packages/remix-react/routes.tsx @@ -148,11 +148,11 @@ export function createServerRoutes( index: route.index, path: route.path, handle: routeModule.handle, - // For SPA Mode, all routes are lazy except root. We don't need a full - // implementation here though - just need a `lazy` prop to tell the RR - // rendering where to stop - lazy: - isSpaMode && route.id !== "root" ? () => spaModeLazyPromise : undefined, + // For SPA Mode, all routes are lazy except root. However we tell the + // router root is also lazy here too since we don't need a full + // implementation - we just need a `lazy` prop to tell the RR rendering + // where to stop which is always at the root route in SPA mode + lazy: isSpaMode ? () => spaModeLazyPromise : undefined, // For partial hydration rendering, we need to indicate when the route // has a loader/clientLoader, but it won't ever be called during the static // render, so just give it a no-op function so we can render down to the