@samitouri / QOS-React-2 / commits / 31a9e391f7

Remove unnecessary lines for `hasBadMapPolyfill` issue for rollup (#16231)

Mohammad Aziz committed Mar 22, 2020 at 20:22 UTC 31a9e391f757d374ce0065da6735f08137151507
2 files changed +8 -14
packages/react-reconciler/src/ReactFiber.js
+4 -7
@@ -101,13 +101,10 @@ if (__DEV__) {
101 hasBadMapPolyfill = false;
102 try {
103 const nonExtensibleObject = Object.preventExtensions({});
104 - const testMap = new Map([[nonExtensibleObject, null]]);
105 - const testSet = new Set([nonExtensibleObject]);
106 - // This is necessary for Rollup to not consider these unused.
107 - // https://github.com/rollup/rollup/issues/1771
108 - // TODO: we can remove these if Rollup fixes the bug.
109 - testMap.set(0, 0);
110 - testSet.add(0);
104 + /* eslint-disable no-new */
105 + new Map([[nonExtensibleObject, null]]);
106 + new Set([nonExtensibleObject]);
107 + /* eslint-enable no-new */
108 } catch (e) {
109 // TODO: Consider warning about bad polyfills
110 hasBadMapPolyfill = true;
packages/react/src/BadMapPolyfill.js
+4 -7
@@ -12,13 +12,10 @@ if (__DEV__) {
12 hasBadMapPolyfill = false;
13 try {
14 const frozenObject = Object.freeze({});
15 - const testMap = new Map([[frozenObject, null]]);
16 - const testSet = new Set([frozenObject]);
17 - // This is necessary for Rollup to not consider these unused.
18 - // https://github.com/rollup/rollup/issues/1771
19 - // TODO: we can remove these if Rollup fixes the bug.
20 - testMap.set(0, 0);
21 - testSet.add(0);
15 + /* eslint-disable no-new */
16 + new Map([[frozenObject, null]]);
17 + new Set([frozenObject]);
18 + /* eslint-enable no-new */
19 } catch (e) {
20 // TODO: Consider warning about bad polyfills
21 hasBadMapPolyfill = true;