Skip to content

Commit

Permalink
[Bugfix] Check tag before calling hook effects
Browse files Browse the repository at this point in the history
TODO: Test that triggers this
  • Loading branch information
acdlite committed Jul 26, 2019
1 parent c0830a0 commit 96d8d2b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/react-reconciler/src/ReactFiberWorkLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -1953,7 +1953,15 @@ export function flushPassiveEffects() {
resetCurrentDebugFiberInDEV();
} else {
try {
commitPassiveHookEffects(effect);
switch (effect.tag) {
case FunctionComponent:
case ForwardRef:
case SimpleMemoComponent:
commitPassiveHookEffects(effect);
break;
default:
break;
}
} catch (error) {
invariant(effect !== null, 'Should be working on an effect.');
captureCommitPhaseError(effect, error);
Expand Down

0 comments on commit 96d8d2b

Please sign in to comment.