@samitouri / QOS-React / commits / 7de4d23919

Fix UMD builds by re-exporting the scheduler priorities (#14914)

Dan Abramov committed Feb 21, 2019 at 17:20 UTC 7de4d23919ab5c67a708560a5166b8cdb1547e26
5 files changed +81 -2
packages/react/src/ReactSharedInternals.js
+10
@@ -18,6 +18,11 @@ import {
18 unstable_continueExecution,
19 unstable_wrapCallback,
20 unstable_getCurrentPriorityLevel,
21 + unstable_IdlePriority,
22 + unstable_ImmediatePriority,
23 + unstable_LowPriority,
24 + unstable_NormalPriority,
25 + unstable_UserBlockingPriority,
26 } from 'scheduler';
27 import {
28 __interactionsRef,
@@ -60,6 +65,11 @@ if (__UMD__) {
65 unstable_pauseExecution,
66 unstable_continueExecution,
67 unstable_getCurrentPriorityLevel,
68 + unstable_IdlePriority,
69 + unstable_ImmediatePriority,
70 + unstable_LowPriority,
71 + unstable_NormalPriority,
72 + unstable_UserBlockingPriority,
73 },
74 SchedulerTracing: {
75 __interactionsRef,
packages/scheduler/npm/umd/scheduler.development.js
+20
@@ -108,5 +108,25 @@
108 unstable_continueExecution: unstable_continueExecution,
109 unstable_pauseExecution: unstable_pauseExecution,
110 unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
111 + get unstable_IdlePriority() {
112 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
113 + .Scheduler.unstable_IdlePriority;
114 + },
115 + get unstable_ImmediatePriority() {
116 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
117 + .Scheduler.unstable_ImmediatePriority;
118 + },
119 + get unstable_LowPriority() {
120 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
121 + .Scheduler.unstable_LowPriority;
122 + },
123 + get unstable_NormalPriority() {
124 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
125 + .Scheduler.unstable_NormalPriority;
126 + },
127 + get unstable_UserBlockingPriority() {
128 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
129 + .Scheduler.unstable_UserBlockingPriority;
130 + },
131 });
132 });
packages/scheduler/npm/umd/scheduler.production.min.js
+20
@@ -102,5 +102,25 @@
102 unstable_continueExecution: unstable_continueExecution,
103 unstable_pauseExecution: unstable_pauseExecution,
104 unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
105 + get unstable_IdlePriority() {
106 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
107 + .Scheduler.unstable_IdlePriority;
108 + },
109 + get unstable_ImmediatePriority() {
110 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
111 + .Scheduler.unstable_ImmediatePriority;
112 + },
113 + get unstable_LowPriority() {
114 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
115 + .Scheduler.unstable_LowPriority;
116 + },
117 + get unstable_NormalPriority() {
118 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
119 + .Scheduler.unstable_NormalPriority;
120 + },
121 + get unstable_UserBlockingPriority() {
122 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
123 + .Scheduler.unstable_UserBlockingPriority;
124 + },
125 });
126 });
packages/scheduler/npm/umd/scheduler.profiling.min.js
+20
@@ -102,5 +102,25 @@
102 unstable_continueExecution: unstable_continueExecution,
103 unstable_pauseExecution: unstable_pauseExecution,
104 unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
105 + get unstable_IdlePriority() {
106 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
107 + .Scheduler.unstable_IdlePriority;
108 + },
109 + get unstable_ImmediatePriority() {
110 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
111 + .Scheduler.unstable_ImmediatePriority;
112 + },
113 + get unstable_LowPriority() {
114 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
115 + .Scheduler.unstable_LowPriority;
116 + },
117 + get unstable_NormalPriority() {
118 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
119 + .Scheduler.unstable_NormalPriority;
120 + },
121 + get unstable_UserBlockingPriority() {
122 + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
123 + .Scheduler.unstable_UserBlockingPriority;
124 + },
125 });
126 });
packages/scheduler/src/__tests__/SchedulerUMDBundle-test.internal.js
+11 -2
@@ -17,8 +17,17 @@ describe('Scheduling UMD bundle', () => {
17 });
18
19 function filterPrivateKeys(name) {
20 - // TODO: Figure out how to forward priority levels.
21 - return !name.startsWith('_') && !name.endsWith('Priority');
20 + // Be very careful adding things to this whitelist!
21 + // It's easy to introduce bugs by doing it:
22 + // https://github.com/facebook/react/issues/14904
23 + switch (name) {
24 + case '__interactionsRef':
25 + case '__subscriberRef':
26 + // Don't forward these. (TODO: why?)
27 + return false;
28 + default:
29 + return true;
30 + }
31 }
32
33 function validateForwardedAPIs(api, forwardedAPIs) {