Skip to content

Commit

Permalink
Handle falsy errors correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Feb 14, 2024
1 parent a8bedaa commit 3ba3024
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/react-router/lib/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ export function _renderMatches(
let errors = dataRouterState?.errors;
if (errors != null) {
let errorIndex = renderedMatches.findIndex(
(m) => m.route.id && errors?.[m.route.id]
(m) => m.route.id && errors?.[m.route.id] !== undefined
);
invariant(
errorIndex >= 0,
Expand Down
4 changes: 1 addition & 3 deletions packages/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
warning,
} from "./history";
import type {
ActionFunction,
AgnosticDataRouteMatch,
AgnosticDataRouteObject,
DataStrategyMatch,
Expand All @@ -25,7 +24,6 @@ import type {
HTMLFormMethod,
HandlerResult,
ImmutableRouteKey,
LoaderFunction,
MapRoutePropertiesFunction,
MutationFormMethod,
RedirectResult,
Expand Down Expand Up @@ -4214,7 +4212,7 @@ async function callLoaderOrAction(
}),
loadLazyRouteModule(match.route, mapRouteProperties, manifest),
]);
if (handlerError) {
if (handlerError !== undefined) {
throw handlerError;
}
result = values[0];
Expand Down

0 comments on commit 3ba3024

Please sign in to comment.