Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resource routes being loaded through route.lazy #7498

Merged
merged 5 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix check
  • Loading branch information
brophdawg11 committed Sep 21, 2023
commit 64e0a5cde2ae4dbebe0bb4b9779db7be0b470c28
8 changes: 5 additions & 3 deletions packages/remix-react/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,15 @@ async function loadRouteModuleWithBlockingLinks(

// Resource routes are built with an empty object as the default export -
// ignore those when setting the Component
let hasComponent =
let defaultExportIsEmptyObject =
typeof routeModule.default === "object" &&
Object.keys(routeModule.default).length > 0;
Object.keys(routeModule.default).length === 0;

// Include all `browserSafeRouteExports` fields
return {
...(hasComponent ? { Component: routeModule.default } : {}),
...(routeModule.default != null && !defaultExportIsEmptyObject
? { Component: routeModule.default }
: {}),
ErrorBoundary: routeModule.ErrorBoundary,
handle: routeModule.handle,
links: routeModule.links,
Expand Down