File tree Expand file tree Collapse file tree 4 files changed +48
-0
lines changed Expand file tree Collapse file tree 4 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,18 @@ let didWarnSetStateChildContext;
168168let warnAboutUpdateOnUnmounted ;
169169let warnAboutInvalidUpdates ;
170170
171+ if ( enableSchedulerTracking ) {
172+ // Provide explicit error message when production+profiling bundle of e.g. react-dom
173+ // is used with production (non-profiling) bundle of schedule/tracking
174+ invariant (
175+ __interactionsRef != null && __interactionsRef . current != null ,
176+ 'It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) ' +
177+ 'without also replacing the `schedule/tracking` module with `schedule/tracking-profiling`. ' +
178+ 'Your bundler might have a setting for aliasing both modules. ' +
179+ 'Learn more at http://fb.me/react-profiling' ,
180+ ) ;
181+ }
182+
171183if ( __DEV__ ) {
172184 didWarnAboutStateTransition = false ;
173185 didWarnSetStateChildContext = false ;
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Facebook, Inc. and its affiliates.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ *
7+ * @emails react-core
8+ * @jest -environment node
9+ */
10+
11+ 'use strict' ;
12+
13+ describe ( 'ReactTracking' , ( ) => {
14+ it ( 'should error if profiling renderer and non-profiling schedule/tracking bundles are combined' , ( ) => {
15+ jest . resetModules ( ) ;
16+
17+ const ReactFeatureFlags = require ( 'shared/ReactFeatureFlags' ) ;
18+ ReactFeatureFlags . enableSchedulerTracking = false ;
19+
20+ require ( 'schedule/tracking' ) ;
21+
22+ ReactFeatureFlags . enableSchedulerTracking = true ;
23+
24+ expect ( ( ) => require ( 'react-dom' ) ) . toThrow (
25+ 'Learn more at http://fb.me/react-profiling' ,
26+ ) ;
27+ } ) ;
28+ } ) ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ if ( process . env . NODE_ENV === 'production' ) {
4+ module . exports = require ( './cjs/schedule-tracking.profiling.min.js' ) ;
5+ } else {
6+ module . exports = require ( './cjs/schedule-tracking.development.js' ) ;
7+ }
Original file line number Diff line number Diff line change 2020 " README.md" ,
2121 " index.js" ,
2222 " tracking.js" ,
23+ " tracking-profiling.js" ,
2324 " cjs/" ,
2425 " umd/"
2526 ]
You can’t perform that action at this time.
0 commit comments