Skip to content

Commit

Permalink
[Flare] Ensure we check for bad polyfill when creating responders (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm committed Jul 29, 2019
1 parent 47656bf commit 55bc393
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/shared/createEventResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import type {ReactEventResponder} from 'shared/ReactTypes';
import {REACT_RESPONDER_TYPE} from 'shared/ReactSymbols';
import {hasBadMapPolyfill} from './hasBadMapPolyfill';

export default function createEventResponder<E, C>(
displayName: string,
Expand Down Expand Up @@ -35,7 +36,10 @@ export default function createEventResponder<E, C>(
rootEventTypes: rootEventTypes || null,
targetEventTypes: targetEventTypes || null,
};
if (__DEV__) {
// We use responder as a Map key later on. When we have a bad
// polyfill, then we can't use it as a key as the polyfill tries
// to add a property to the object.
if (__DEV__ && !hasBadMapPolyfill) {
Object.freeze(eventResponder);
}
return eventResponder;
Expand Down

0 comments on commit 55bc393

Please sign in to comment.