@@ -33,11 +33,7 @@ import {
3333 Update as UpdateEffect ,
3434 LifecycleEffectMask ,
3535} from 'shared/ReactSideEffectTags' ;
36- import {
37- enableGetDerivedStateFromCatch ,
38- enableSuspense ,
39- enableSchedulerTracing ,
40- } from 'shared/ReactFeatureFlags' ;
36+ import { enableSuspense , enableSchedulerTracing } from 'shared/ReactFeatureFlags' ;
4137import { StrictMode , ConcurrentMode } from './ReactTypeOfMode' ;
4238
4339import { createCapturedValue } from './ReactCapturedValue' ;
@@ -105,10 +101,7 @@ function createClassErrorUpdate(
105101 const update = createUpdate ( expirationTime ) ;
106102 update . tag = CaptureUpdate ;
107103 const getDerivedStateFromCatch = fiber . type . getDerivedStateFromCatch ;
108- if (
109- enableGetDerivedStateFromCatch &&
110- typeof getDerivedStateFromCatch === 'function'
111- ) {
104+ if ( typeof getDerivedStateFromCatch === 'function' ) {
112105 const error = errorInfo . value ;
113106 update . payload = ( ) => {
114107 return getDerivedStateFromCatch ( error ) ;
@@ -118,10 +111,7 @@ function createClassErrorUpdate(
118111 const inst = fiber . stateNode ;
119112 if ( inst !== null && typeof inst . componentDidCatch === 'function' ) {
120113 update . callback = function callback ( ) {
121- if (
122- ! enableGetDerivedStateFromCatch ||
123- getDerivedStateFromCatch !== 'function'
124- ) {
114+ if ( getDerivedStateFromCatch !== 'function' ) {
125115 // To preserve the preexisting retry behavior of error boundaries,
126116 // we keep track of which ones already failed during this batch.
127117 // This gets reset before we yield back to the browser.
@@ -364,8 +354,7 @@ function throwException(
364354 const instance = workInProgress . stateNode ;
365355 if (
366356 ( workInProgress . effectTag & DidCapture ) === NoEffect &&
367- ( ( typeof ctor . getDerivedStateFromCatch === 'function' &&
368- enableGetDerivedStateFromCatch ) ||
357+ ( typeof ctor . getDerivedStateFromCatch === 'function' ||
369358 ( instance !== null &&
370359 typeof instance . componentDidCatch === 'function' &&
371360 ! isAlreadyFailedLegacyErrorBoundary ( instance ) ) )
0 commit comments