Skip to content

Commit 7467f51

Browse files
author
Brian Vaughn
committed
Removed incorrect .return accessor from captureCommitPhaseErrorForUnmountedFiber()
1 parent b91b80c commit 7467f51

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3170,7 +3170,7 @@ export function captureCommitPhaseErrorForUnmountedFiber(
31703170
nearestMountedAncestor: Fiber,
31713171
error: mixed,
31723172
) {
3173-
let fiber = nearestMountedAncestor.return;
3173+
let fiber = nearestMountedAncestor;
31743174
while (fiber !== null) {
31753175
if (fiber.tag === HostRoot) {
31763176
captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);

packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,7 @@ describe('ReactHooksWithNoopRenderer', () => {
23552355
return <span prop="ErrorBoundary fallback" />;
23562356
}
23572357
Scheduler.unstable_yieldValue('ErrorBoundary render success');
2358-
return this.props.children;
2358+
return this.props.children || null;
23592359
}
23602360
};
23612361

@@ -2377,7 +2377,7 @@ describe('ReactHooksWithNoopRenderer', () => {
23772377
Scheduler.unstable_yieldValue(
23782378
'DerivedStateOnlyErrorBoundary render success',
23792379
);
2380-
return this.props.children;
2380+
return this.props.children || null;
23812381
}
23822382
};
23832383

@@ -2389,7 +2389,7 @@ describe('ReactHooksWithNoopRenderer', () => {
23892389
}
23902390
render() {
23912391
Scheduler.unstable_yieldValue(`LogOnlyErrorBoundary render`);
2392-
return this.props.children;
2392+
return this.props.children || null;
23932393
}
23942394
};
23952395
});
@@ -2551,18 +2551,10 @@ describe('ReactHooksWithNoopRenderer', () => {
25512551

25522552
// @gate new
25532553
it('should use the nearest still-mounted boundary if there are no unmounted boundaries', () => {
2554-
function Conditional({showChildren}) {
2555-
if (showChildren) {
2556-
return <BrokenUseEffectCleanup />;
2557-
} else {
2558-
return null;
2559-
}
2560-
}
2561-
25622554
act(() => {
25632555
ReactNoop.render(
25642556
<LogOnlyErrorBoundary>
2565-
<Conditional showChildren={true} />
2557+
<BrokenUseEffectCleanup />
25662558
</LogOnlyErrorBoundary>,
25672559
);
25682560
});
@@ -2573,11 +2565,7 @@ describe('ReactHooksWithNoopRenderer', () => {
25732565
]);
25742566

25752567
act(() => {
2576-
ReactNoop.render(
2577-
<LogOnlyErrorBoundary>
2578-
<Conditional showChildren={false} />
2579-
</LogOnlyErrorBoundary>,
2580-
);
2568+
ReactNoop.render(<LogOnlyErrorBoundary />);
25812569
});
25822570

25832571
expect(Scheduler).toHaveYielded([

0 commit comments

Comments
 (0)