Skip to content

Commit

Permalink
Fix host context issues around EventComponents and EventTargets (#15284)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm authored Apr 1, 2019
1 parent 5ef0d1d commit 4482fdd
Show file tree
Hide file tree
Showing 3 changed files with 551 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -2112,8 +2112,15 @@ function beginWork(
// been unsuspended it has committed as a regular Suspense component.
// If it needs to be retried, it should have work scheduled on it.
workInProgress.effectTag |= DidCapture;
break;
}
break;
}
case EventComponent:
case EventTarget: {
if (enableEventAPI) {
pushHostContextForEvent(workInProgress);
}
break;
}
}
return bailoutOnAlreadyFinishedWork(
Expand Down
9 changes: 9 additions & 0 deletions packages/react-reconciler/src/ReactFiberUnwindWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
SuspenseComponent,
DehydratedSuspenseComponent,
IncompleteClassComponent,
EventComponent,
EventTarget,
} from 'shared/ReactWorkTags';
import {
DidCapture,
Expand All @@ -38,6 +40,7 @@ import {
import {
enableSchedulerTracing,
enableSuspenseServerRenderer,
enableEventAPI,
} from 'shared/ReactFeatureFlags';
import {ConcurrentMode} from './ReactTypeOfMode';
import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent';
Expand Down Expand Up @@ -510,6 +513,12 @@ function unwindWork(
case ContextProvider:
popProvider(workInProgress);
return null;
case EventComponent:
case EventTarget:
if (enableEventAPI) {
popHostContext(workInProgress);
}
return null;
default:
return null;
}
Expand Down
Loading

0 comments on commit 4482fdd

Please sign in to comment.