You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Warn about legacy context when legacy context is not disabled (#30297)
For environments that still have legacy contexts available, this adds a
warning to make the remaining call sites easier to locate and encourage
upgrades.
DiffTrain build for [378b305](378b305)
Copy file name to clipboardExpand all lines: compiled/facebook-www/ReactART-dev.classic.js
+28-3Lines changed: 28 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5796,6 +5796,20 @@ __DEV__ &&
5796
5796
"%s declares both contextTypes and contextType static properties. The legacy contextTypes property will be ignored.",
5797
5797
name
5798
5798
));
5799
+
ctor.childContextTypes &&
5800
+
!didWarnAboutChildContextTypes.has(ctor) &&
5801
+
(didWarnAboutChildContextTypes.add(ctor),
5802
+
error$jscomp$0(
5803
+
"%s uses the legacy childContextTypes API which will soon be removed. Use React.createContext() instead. (https://react.dev/link/legacy-context)",
5804
+
name
5805
+
));
5806
+
ctor.contextTypes &&
5807
+
!didWarnAboutContextTypes$1.has(ctor) &&
5808
+
(didWarnAboutContextTypes$1.add(ctor),
5809
+
error$jscomp$0(
5810
+
"%s uses the legacy contextTypes API which will soon be removed. Use React.createContext() with static contextType instead. (https://react.dev/link/legacy-context)",
"%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",
"%s uses the legacy contextTypes API which will be removed soon. Use React.createContext() with React.useContext() instead. (https://react.dev/link/legacy-context)",
6721
+
componentName
6722
+
))));
6701
6723
componentName = isContextProvider(Component)
6702
6724
? previousContext
6703
6725
: contextStackCursor$1.current;
@@ -16416,6 +16438,8 @@ __DEV__ &&
16416
16438
var didWarnAboutDirectlyAssigningPropsToState = new Set();
16417
16439
var didWarnAboutUndefinedDerivedState = new Set();
16418
16440
var didWarnAboutContextTypeAndContextTypes = new Set();
16441
+
var didWarnAboutContextTypes$1 = new Set();
16442
+
var didWarnAboutChildContextTypes = new Set();
16419
16443
var didWarnAboutInvalidateContextType = new Set();
16420
16444
var didWarnOnInvalidCallback = new Set();
16421
16445
Object.freeze(fakeInternalInstance);
@@ -16543,6 +16567,7 @@ __DEV__ &&
16543
16567
didReceiveUpdate = !1;
16544
16568
var didWarnAboutBadClass = {};
16545
16569
var didWarnAboutContextTypeOnFunctionComponent = {};
16570
+
var didWarnAboutContextTypes = {};
16546
16571
var didWarnAboutGetDerivedStateOnFunctionComponent = {};
"%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with React.useContext() instead. (https://react.dev/link/legacy-context)",
"%s uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.",
6469
+
"%s uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead. (https://react.dev/link/legacy-context)",
6467
6470
state
6468
6471
));
6469
6472
Component.contextTypes &&
6470
-
!didWarnAboutContextTypes.has(Component) &&
6471
-
(didWarnAboutContextTypes.add(Component),
6473
+
!didWarnAboutContextTypes$1.has(Component) &&
6474
+
(didWarnAboutContextTypes$1.add(Component),
6472
6475
error$jscomp$0(
6473
-
"%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with static contextType instead.",
6476
+
"%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with static contextType instead. (https://react.dev/link/legacy-context)",
0 commit comments