Skip to content

Commit f61d7e4

Browse files
committed
fix: pass live ErrorBoundary reset into CaughtError
Native fallback already receives reset during tryBlock, but the adapter snapshotted resetRef before that assignment, so the first caught render could recover with a null handle.
1 parent 5c07531 commit f61d7e4

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@octanejs/react-error-boundary": patch
3+
---
4+
5+
Pass the native ErrorBoundary fallback's live reset function into CaughtError instead of snapshotting resetRef before tryBlock assigns it.

‎packages/react-error-boundary/src/error-boundary.tsrx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ export function ErrorBoundary(props: ErrorBoundaryProps) @{
3232

3333
<NativeErrorBoundary
3434
resetRef={nativeResetRef}
35-
fallback={(error: unknown) =>
35+
fallback={(error: unknown, reset: () => void) =>
3636
<CaughtError
3737
error={error}
38-
reset={nativeResetRef.current!}
38+
reset={reset}
3939
resetErrorBoundary={resetErrorBoundary}
4040
caughtRef={caughtRef}
4141
propsRef={propsRef}

0 commit comments

Comments
 (0)