Skip to content

Commit

Permalink
Catch errors on loading fallback
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia committed Jul 23, 2024
1 parent b2d29c2 commit ed2969d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions components/section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,16 @@ export const withSection = <TProps, TLoaderProps = TProps>(
metadata,
LoadingFallback: () => (
<LoadingFallback
{
{...new Proxy<Partial<TProps>>(loaderProps ?? props, {
get: (value: Partial<TProps>, prop) => {
try {
return Reflect.get(value, prop);
} catch (_) {
return undefined;
}
},
// deno-lint-ignore no-explicit-any
...((loaderProps ?? props) as any)
}
}) as any}
/>
),
};
Expand Down

0 comments on commit ed2969d

Please sign in to comment.