Event API: responder event types should not re-register on EventComponent update (#15514)

This commit is contained in:
Dominic Gannaway
2019-04-26 21:33:54 +01:00
committed by GitHub
parent c4d1dcb533
commit 796c67a25f
2 changed files with 12 additions and 9 deletions
+10 -9
View File
@@ -894,20 +894,14 @@ export function didNotFindHydratableSuspenseInstance(
export function mountEventComponent(
eventComponentInstance: ReactEventComponentInstance,
): void {
if (enableEventAPI) {
updateEventComponent(eventComponentInstance);
mountEventResponder(eventComponentInstance);
}
}
export function updateEventComponent(
eventComponentInstance: ReactEventComponentInstance,
): void {
if (enableEventAPI) {
const rootContainerInstance = ((eventComponentInstance.rootInstance: any): Container);
const rootElement = rootContainerInstance.ownerDocument;
const responder = eventComponentInstance.responder;
if (__DEV__) {
Object.freeze(responder);
}
const {rootEventTypes, targetEventTypes} = responder;
if (targetEventTypes !== undefined) {
listenToEventResponderEventTypes(targetEventTypes, rootElement);
@@ -919,9 +913,16 @@ export function updateEventComponent(
);
listenToEventResponderEventTypes(rootEventTypes, rootElement);
}
mountEventResponder(eventComponentInstance);
}
}
export function updateEventComponent(
eventComponentInstance: ReactEventComponentInstance,
): void {
// NO-OP, why might use this in the future
}
export function unmountEventComponent(
eventComponentInstance: ReactEventComponentInstance,
): void {
@@ -886,5 +886,7 @@ describe('DOMEventResponderSystem', () => {
passiveSupported: true,
},
]);
ReactDOM.render(<Test />, container);
});
});