@@ -19,8 +19,7 @@ import {
19
19
warnAboutDeprecatedLifecycles ,
20
20
} from 'shared/ReactFeatureFlags' ;
21
21
import ReactStrictModeWarnings from './ReactStrictModeWarnings' ;
22
- import { isMounted } from 'react-reconciler/reflection' ;
23
- import { get as getInstance , set as setInstance } from 'shared/ReactInstanceMap' ;
22
+ import { set as setInstance } from 'shared/ReactInstanceMap' ;
24
23
import shallowEqual from 'shared/shallowEqual' ;
25
24
import getComponentName from 'shared/getComponentName' ;
26
25
import invariant from 'shared/invariant' ;
@@ -31,13 +30,9 @@ import {resolveDefaultProps} from './ReactFiberLazyComponent';
31
30
import { StrictMode } from './ReactTypeOfMode' ;
32
31
33
32
import {
34
- enqueueUpdate ,
35
33
processUpdateQueue ,
36
34
checkHasForceUpdateAfterProcessing ,
37
35
resetHasForceUpdateBeforeProcessing ,
38
- createUpdate ,
39
- ReplaceState ,
40
- ForceUpdate ,
41
36
initializeUpdateQueue ,
42
37
cloneUpdateQueue ,
43
38
} from './ReactUpdateQueue' ;
@@ -50,12 +45,7 @@ import {
50
45
emptyContextObject ,
51
46
} from './ReactFiberContext' ;
52
47
import { readContext } from './ReactFiberNewContext' ;
53
- import {
54
- requestCurrentTimeForUpdate ,
55
- computeExpirationForFiber ,
56
- scheduleWork ,
57
- } from './ReactFiberWorkLoop' ;
58
- import { requestCurrentSuspenseConfig } from './ReactFiberSuspenseConfig' ;
48
+ import { classComponentUpdater } from './ReactFiberTransition' ;
59
49
60
50
const fakeInternalInstance = { } ;
61
51
const isArray = Array . isArray ;
@@ -70,7 +60,6 @@ let didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
70
60
let didWarnAboutLegacyLifecyclesAndDerivedState ;
71
61
let didWarnAboutUndefinedDerivedState ;
72
62
let warnOnUndefinedDerivedState ;
73
- let warnOnInvalidCallback ;
74
63
let didWarnAboutDirectlyAssigningPropsToState ;
75
64
let didWarnAboutContextTypeAndContextTypes ;
76
65
let didWarnAboutInvalidateContextType ;
@@ -85,24 +74,6 @@ if (__DEV__) {
85
74
didWarnAboutContextTypeAndContextTypes = new Set ( ) ;
86
75
didWarnAboutInvalidateContextType = new Set ( ) ;
87
76
88
- const didWarnOnInvalidCallback = new Set ( ) ;
89
-
90
- warnOnInvalidCallback = function ( callback : mixed , callerName : string ) {
91
- if ( callback === null || typeof callback === 'function' ) {
92
- return ;
93
- }
94
- const key = `${ callerName } _${ ( callback : any ) } ` ;
95
- if ( ! didWarnOnInvalidCallback . has ( key ) ) {
96
- didWarnOnInvalidCallback . add ( key ) ;
97
- console . error (
98
- '%s(...): Expected the last optional `callback` argument to be a ' +
99
- 'function. Instead received: %s.' ,
100
- callerName ,
101
- callback ,
102
- ) ;
103
- }
104
- } ;
105
-
106
77
warnOnUndefinedDerivedState = function ( type , partialState ) {
107
78
if ( partialState === undefined ) {
108
79
const componentName = getComponentName ( type ) || 'Component' ;
@@ -178,79 +149,6 @@ export function applyDerivedStateFromProps(
178
149
}
179
150
}
180
151
181
- const classComponentUpdater = {
182
- isMounted,
183
- enqueueSetState ( inst , payload , callback ) {
184
- const fiber = getInstance ( inst ) ;
185
- const currentTime = requestCurrentTimeForUpdate ( ) ;
186
- const suspenseConfig = requestCurrentSuspenseConfig ( ) ;
187
- const expirationTime = computeExpirationForFiber (
188
- currentTime ,
189
- fiber ,
190
- suspenseConfig ,
191
- ) ;
192
-
193
- const update = createUpdate ( currentTime , expirationTime , suspenseConfig ) ;
194
- update . payload = payload ;
195
- if ( callback !== undefined && callback !== null ) {
196
- if ( __DEV__ ) {
197
- warnOnInvalidCallback ( callback , 'setState' ) ;
198
- }
199
- update . callback = callback ;
200
- }
201
-
202
- enqueueUpdate ( fiber , update ) ;
203
- scheduleWork ( fiber , expirationTime ) ;
204
- } ,
205
- enqueueReplaceState ( inst , payload , callback ) {
206
- const fiber = getInstance ( inst ) ;
207
- const currentTime = requestCurrentTimeForUpdate ( ) ;
208
- const suspenseConfig = requestCurrentSuspenseConfig ( ) ;
209
- const expirationTime = computeExpirationForFiber (
210
- currentTime ,
211
- fiber ,
212
- suspenseConfig ,
213
- ) ;
214
-
215
- const update = createUpdate ( currentTime , expirationTime , suspenseConfig ) ;
216
- update . tag = ReplaceState ;
217
- update . payload = payload ;
218
-
219
- if ( callback !== undefined && callback !== null ) {
220
- if ( __DEV__ ) {
221
- warnOnInvalidCallback ( callback , 'replaceState' ) ;
222
- }
223
- update . callback = callback ;
224
- }
225
-
226
- enqueueUpdate ( fiber , update ) ;
227
- scheduleWork ( fiber , expirationTime ) ;
228
- } ,
229
- enqueueForceUpdate ( inst , callback ) {
230
- const fiber = getInstance ( inst ) ;
231
- const currentTime = requestCurrentTimeForUpdate ( ) ;
232
- const suspenseConfig = requestCurrentSuspenseConfig ( ) ;
233
- const expirationTime = computeExpirationForFiber (
234
- currentTime ,
235
- fiber ,
236
- suspenseConfig ,
237
- ) ;
238
-
239
- const update = createUpdate ( currentTime , expirationTime , suspenseConfig ) ;
240
- update . tag = ForceUpdate ;
241
-
242
- if ( callback !== undefined && callback !== null ) {
243
- if ( __DEV__ ) {
244
- warnOnInvalidCallback ( callback , 'forceUpdate' ) ;
245
- }
246
- update . callback = callback ;
247
- }
248
-
249
- enqueueUpdate ( fiber , update ) ;
250
- scheduleWork ( fiber , expirationTime ) ;
251
- } ,
252
- } ;
253
-
254
152
function checkShouldComponentUpdate (
255
153
workInProgress ,
256
154
ctor ,
0 commit comments