Flow upgrade to 0.146
This upgrade made more expressions invalidate refinements. In some places this lead to a large number of suppressions that I automatically suppressed and should be followed up on when the code is touched. I think most of them might require either manual annotations or moving a value into a const to allow refinement. ghstack-source-id: a45b40abf03474b691a2dc18a4f1f3b06cfbdffd Pull Request resolved: https://github.com/facebook/react/pull/25410
Jan Kassens committed
Oct 4, 2022 at 10:50 UTC
64fe791be84ad04a4a1d005376ba5cf5701db9b7
33 files changed
+138
-10
package.json
+1
-1
@@ -63,7 +63,7 @@
63
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
64
"fbjs-scripts": "1.2.0",
65
"filesize": "^6.0.1",
66
- "flow-bin": "^0.145.0",
66
+ "flow-bin": "^0.146.0",
67
"glob": "^7.1.6",
68
"glob-stream": "^6.1.0",
69
"google-closure-compiler": "^20200517.0.0",
packages/react-devtools-core/src/editor.js
+1
@@ -186,6 +186,7 @@ export function launchEditor(
186
childProcess = spawn(editor, args, {stdio: 'inherit'});
187
}
188
childProcess.on('error', function() {});
189
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
190
childProcess.on('exit', function(errorCode) {
191
childProcess = null;
192
});
packages/react-devtools-shared/src/backend/profilingHooks.js
+10
@@ -350,7 +350,9 @@ export function createProfilingHooks({
350
);
351
}
352
353
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
354
currentReactComponentMeasure.duration =
355
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
356
getRelativeTime() - currentReactComponentMeasure.timestamp;
357
currentReactComponentMeasure = null;
358
}
@@ -393,7 +395,9 @@ export function createProfilingHooks({
395
);
396
}
397
398
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
399
currentReactComponentMeasure.duration =
400
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
401
getRelativeTime() - currentReactComponentMeasure.timestamp;
402
currentReactComponentMeasure = null;
403
}
@@ -438,7 +442,9 @@ export function createProfilingHooks({
442
);
443
}
444
445
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
446
currentReactComponentMeasure.duration =
447
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
448
getRelativeTime() - currentReactComponentMeasure.timestamp;
449
currentReactComponentMeasure = null;
450
}
@@ -481,7 +487,9 @@ export function createProfilingHooks({
487
);
488
}
489
490
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
491
currentReactComponentMeasure.duration =
492
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
493
getRelativeTime() - currentReactComponentMeasure.timestamp;
494
currentReactComponentMeasure = null;
495
}
@@ -526,7 +534,9 @@ export function createProfilingHooks({
534
);
535
}
536
537
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
538
currentReactComponentMeasure.duration =
539
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
540
getRelativeTime() - currentReactComponentMeasure.timestamp;
541
currentReactComponentMeasure = null;
542
}
packages/react-devtools-shared/src/backend/renderer.js
+10
-1
@@ -1310,6 +1310,7 @@ export function attach(
1310
const id = getFiberIDThrows(fiber);
1311
const contexts = getContextsForFiber(fiber);
1312
if (contexts !== null) {
1313
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
1314
idToContextsMap.set(id, contexts);
1315
}
1316
}
@@ -1380,8 +1381,10 @@ export function attach(
1381
function getContextChangedKeys(fiber: Fiber): null | boolean | Array<string> {
1382
if (idToContextsMap !== null) {
1383
const id = getFiberIDThrows(fiber);
1384
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
1385
const prevContexts = idToContextsMap.has(id)
1384
- ? idToContextsMap.get(id)
1386
+ ? // $FlowFixMe[incompatible-use] found when upgrading Flow
1387
+ idToContextsMap.get(id)
1388
: null;
1389
const nextContexts = getContextsForFiber(fiber);
1390
@@ -2636,7 +2639,9 @@ export function attach(
2639
const {effectDuration, passiveEffectDuration} = getEffectDurations(
2640
root,
2641
);
2642
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
2643
currentCommitProfilingMetadata.effectDuration = effectDuration;
2644
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
2645
currentCommitProfilingMetadata.passiveEffectDuration = passiveEffectDuration;
2646
}
2647
}
@@ -3702,6 +3707,7 @@ export function attach(
3707
id,
3708
responseID: requestID,
3709
type: 'full-data',
3710
+ // $FlowFixMe[incompatible-return] found when upgrading Flow
3711
value: cleanedInspectedElement,
3712
};
3713
}
@@ -4276,6 +4282,7 @@ export function attach(
4282
) {
4283
// Is this the next Fiber we should select? Let's compare the frames.
4284
const actualFrame = getPathFrame(fiber);
4285
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
4286
const expectedFrame = trackedPath[trackedPathMatchDepth + 1];
4287
if (expectedFrame === undefined) {
4288
throw new Error('Expected to see a frame at the next depth.');
@@ -4289,6 +4296,7 @@ export function attach(
4296
trackedPathMatchFiber = fiber;
4297
trackedPathMatchDepth++;
4298
// Are we out of frames to match?
4299
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
4300
if (trackedPathMatchDepth === trackedPath.length - 1) {
4301
// There's nothing that can possibly match afterwards.
4302
// Don't check the children.
@@ -4443,6 +4451,7 @@ export function attach(
4451
}
4452
return {
4453
id: getFiberIDThrows(fiber),
4454
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
4455
isFullMatch: trackedPathMatchDepth === trackedPath.length - 1,
4456
};
4457
}
packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js
+2
@@ -45,6 +45,7 @@ const resource: Resource<
45
(element: Element) => {
46
const request = inProgressRequests.get(element);
47
if (request != null) {
48
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
49
return request.promise;
50
}
51
@@ -53,6 +54,7 @@ const resource: Resource<
54
resolveFn = resolve;
55
});
56
57
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
58
inProgressRequests.set(element, {promise, resolveFn});
59
60
return promise;
packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js
+1
@@ -186,6 +186,7 @@ function findHookNames(
186
}
187
188
const key = getHookSourceLocationKey(hookSource);
189
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
190
map.set(key, name);
191
});
192
packages/react-devtools-shared/src/inspectedElementMutableSource.js
+2
@@ -137,6 +137,7 @@ export function inspectElement({
137
138
// A path has been hydrated.
139
// Merge it with the latest copy we have locally and resolve with the merged value.
140
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
141
inspectedElement = inspectedElementCache.get(id) || null;
142
if (inspectedElement !== null) {
143
// Clone element
@@ -150,6 +151,7 @@ export function inspectElement({
151
hydrateHelper(value, ((path: any): Path)),
152
);
153
154
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
155
inspectedElementCache.set(id, inspectedElement);
156
157
return [inspectedElement, type];
packages/react-devtools/app.js
+4
@@ -40,13 +40,16 @@ app.on('ready', function() {
40
}
41
42
// https://stackoverflow.com/questions/32402327/
43
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
44
mainWindow.webContents.on('new-window', function(event, url) {
45
event.preventDefault();
46
require('electron').shell.openExternal(url);
47
});
48
49
// and load the index.html of the app.
50
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
51
mainWindow.loadURL('file://' + __dirname + '/app.html'); // eslint-disable-line no-path-concat
52
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
53
mainWindow.webContents.executeJavaScript(
54
// We use this so that RN can keep relative JSX __source filenames
55
// but "click to open in editor" still works. js1 passes project roots
@@ -55,6 +58,7 @@ app.on('ready', function() {
58
);
59
60
// Emitted when the window is closed.
61
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
62
mainWindow.on('closed', function() {
63
mainWindow = null;
64
});
packages/react-dom-bindings/src/client/ReactDOMFloatClient.js
+3
@@ -241,6 +241,7 @@ function preinit(href: string, options: PreinitOptions) {
241
options,
242
);
243
resource = createStyleResource(
244
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
245
currentDocument,
246
href,
247
precedence,
@@ -347,6 +348,7 @@ export function getResource(
348
} else {
349
const resourceProps = stylePropsFromRawProps(styleRawProps);
350
resource = createStyleResource(
351
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
352
currentDocument,
353
href,
354
precedence,
@@ -382,6 +384,7 @@ export function getResource(
384
} else {
385
const resourceProps = preloadPropsFromRawProps(preloadRawProps);
386
resource = createPreloadResource(
387
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
388
currentDocument,
389
href,
390
resourceProps,
packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js
+1
@@ -227,6 +227,7 @@ function extractCompositionEvent(
227
}
228
}
229
230
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
231
const listeners = accumulateTwoPhaseListeners(targetInst, eventType);
232
if (listeners.length > 0) {
233
// $FlowFixMe[incompatible-type]
packages/react-dom-bindings/src/events/plugins/EnterLeaveEventPlugin.js
+1
@@ -104,6 +104,7 @@ function extractEvents(
104
const nearestMounted = getNearestMountedFiber(to);
105
if (
106
to !== nearestMounted ||
107
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
108
(to.tag !== HostComponent && to.tag !== HostText)
109
) {
110
to = null;
packages/react-dom-bindings/src/server/ReactDOMFloatServer.js
+15
@@ -144,6 +144,7 @@ function preload(href: string, options: PreloadOptions) {
144
options !== null
145
) {
146
const as = options.as;
147
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
148
let resource = currentResources.preloadsMap.get(href);
149
if (resource) {
150
if (__DEV__) {
@@ -159,12 +160,14 @@ function preload(href: string, options: PreloadOptions) {
160
}
161
} else {
162
resource = createPreloadResource(
163
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
164
currentResources,
165
href,
166
as,
167
preloadPropsFromPreloadOptions(href, as, options),
168
);
169
}
170
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
171
captureExplicitPreloadResourceDependency(currentResources, resource);
172
}
173
}
@@ -199,6 +202,7 @@ function preinit(href: string, options: PreinitOptions) {
202
case 'style': {
203
const precedence = options.precedence || 'default';
204
205
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
206
let resource = currentResources.stylesMap.get(href);
207
if (resource) {
208
if (__DEV__) {
@@ -216,6 +220,7 @@ function preinit(href: string, options: PreinitOptions) {
220
options,
221
);
222
resource = createStyleResource(
223
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
224
currentResources,
225
href,
226
precedence,
@@ -224,6 +229,7 @@ function preinit(href: string, options: PreinitOptions) {
229
}
230
231
// Do not associate preinit style resources with any specific boundary regardless of where it is called
232
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
233
captureStyleResourceDependency(currentResources, null, resource);
234
235
return;
@@ -459,9 +465,11 @@ export function resourcesFromLink(props: Props): boolean {
465
if (__DEV__) {
466
validateLinkPropsForStyleResource(props);
467
}
468
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
469
let preloadResource = currentResources.preloadsMap.get(href);
470
if (!preloadResource) {
471
preloadResource = createPreloadResource(
472
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
473
currentResources,
474
href,
475
'style',
@@ -472,6 +480,7 @@ export function resourcesFromLink(props: Props): boolean {
480
}
481
}
482
captureImplicitPreloadResourceDependency(
483
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
484
currentResources,
485
preloadResource,
486
);
@@ -492,6 +501,7 @@ export function resourcesFromLink(props: Props): boolean {
501
} else {
502
const resourceProps = stylePropsFromRawProps(href, precedence, props);
503
resource = createStyleResource(
504
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
505
currentResources,
506
href,
507
precedence,
@@ -499,7 +509,9 @@ export function resourcesFromLink(props: Props): boolean {
509
);
510
}
511
captureStyleResourceDependency(
512
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
513
currentResources,
514
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
515
currentResources.boundaryResources,
516
resource,
517
);
@@ -519,6 +531,7 @@ export function resourcesFromLink(props: Props): boolean {
531
if (__DEV__) {
532
validateLinkPropsForPreloadResource(props);
533
}
534
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
535
let resource = currentResources.preloadsMap.get(href);
536
if (resource) {
537
if (__DEV__) {
@@ -534,12 +547,14 @@ export function resourcesFromLink(props: Props): boolean {
547
}
548
} else {
549
resource = createPreloadResource(
550
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
551
currentResources,
552
href,
553
as,
554
preloadPropsFromRawProps(href, as, props),
555
);
556
}
557
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
558
captureExplicitPreloadResourceDependency(currentResources, resource);
559
return true;
560
}
packages/react-fs/src/ReactFilesystem.js
+6
@@ -121,6 +121,7 @@ export function access(path: string, mode?: number): void {
121
record = createRecordFromThenable(thenable);
122
accessCache.push(mode, record);
123
}
124
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
125
readRecord(record); // No return value.
126
}
127
@@ -154,6 +155,7 @@ export function lstat(path: string, options?: {bigint?: boolean}): mixed {
155
record = createRecordFromThenable(thenable);
156
lstatCache.push(bigint, record);
157
}
158
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
159
const stats = readRecord(record).value;
160
return stats;
161
}
@@ -203,6 +205,7 @@ export function readdir(
205
record = createRecordFromThenable(thenable);
206
readdirCache.push(encoding, withFileTypes, record);
207
}
208
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
209
const files = readRecord(record).value;
210
return files;
211
}
@@ -301,6 +304,7 @@ export function readlink(
304
record = createRecordFromThenable(thenable);
305
readlinkCache.push(encoding, record);
306
}
307
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
308
const linkString = readRecord(record).value;
309
return linkString;
310
}
@@ -342,6 +346,7 @@ export function realpath(
346
record = createRecordFromThenable(thenable);
347
realpathCache.push(encoding, record);
348
}
349
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
350
const resolvedPath = readRecord(record).value;
351
return resolvedPath;
352
}
@@ -376,6 +381,7 @@ export function stat(path: string, options?: {bigint?: boolean}): mixed {
381
record = createRecordFromThenable(thenable);
382
statCache.push(bigint, record);
383
}
384
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
385
const stats = readRecord(record).value;
386
return stats;
387
}
packages/react-native-renderer/src/ReactNativeAttributePayload.js
+3
-1
@@ -98,6 +98,7 @@ function restoreDeletedValuesInNestedArray(
98
: nextProp;
99
updatePayload[propKey] = nextValue;
100
}
101
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
102
removedKeys[propKey] = false;
103
removedKeyCount--;
104
}
@@ -356,7 +357,8 @@ function diffProperties(
357
if (shouldUpdate) {
358
const nextValue =
359
typeof attributeConfig.process === 'function'
359
- ? attributeConfig.process(nextProp)
360
+ ? // $FlowFixMe[incompatible-use] found when upgrading Flow
361
+ attributeConfig.process(nextProp)
362
: nextProp;
363
(updatePayload || (updatePayload = {}))[propKey] = nextValue;
364
}
packages/react-reconciler/src/ReactFiberCommitWork.new.js
+4
@@ -350,6 +350,7 @@ function commitBeforeMutationEffects_begin() {
350
// Let's skip the whole loop if it's off.
351
if (enableCreateEventHandleAPI) {
352
// TODO: Should wrap this in flags check, too, as optimization
353
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
354
const deletions = fiber.deletions;
355
if (deletions !== null) {
356
for (let i = 0; i < deletions.length; i++) {
@@ -359,8 +360,10 @@ function commitBeforeMutationEffects_begin() {
360
}
361
}
362
363
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
364
const child = fiber.child;
365
if (
366
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
367
(fiber.subtreeFlags & BeforeMutationMask) !== NoFlags &&
368
child !== null
369
) {
@@ -405,6 +408,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork: Fiber) {
408
if (
409
finishedWork.tag === SuspenseComponent &&
410
isSuspenseBoundaryBeingHidden(current, finishedWork) &&
411
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
412
doesFiberContain(finishedWork, focusedInstanceHandle)
413
) {
414
shouldFireAfterActiveInstanceBlur = true;
packages/react-reconciler/src/ReactFiberCommitWork.old.js
+4
@@ -350,6 +350,7 @@ function commitBeforeMutationEffects_begin() {
350
// Let's skip the whole loop if it's off.
351
if (enableCreateEventHandleAPI) {
352
// TODO: Should wrap this in flags check, too, as optimization
353
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
354
const deletions = fiber.deletions;
355
if (deletions !== null) {
356
for (let i = 0; i < deletions.length; i++) {
@@ -359,8 +360,10 @@ function commitBeforeMutationEffects_begin() {
360
}
361
}
362
363
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
364
const child = fiber.child;
365
if (
366
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
367
(fiber.subtreeFlags & BeforeMutationMask) !== NoFlags &&
368
child !== null
369
) {
@@ -405,6 +408,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork: Fiber) {
408
if (
409
finishedWork.tag === SuspenseComponent &&
410
isSuspenseBoundaryBeingHidden(current, finishedWork) &&
411
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
412
doesFiberContain(finishedWork, focusedInstanceHandle)
413
) {
414
shouldFireAfterActiveInstanceBlur = true;
packages/react-reconciler/src/ReactFiberHotReloading.new.js
+1
@@ -191,6 +191,7 @@ export function isCompatibleFamilyForHotReloading(
191
// then we would risk falsely saying two separate memo(Foo)
192
// calls are equivalent because they wrap the same Foo function.
193
const prevFamily = resolveFamily(prevType);
194
+ // $FlowFixMe[not-a-function] found when upgrading Flow
195
if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
196
return true;
197
}
packages/react-reconciler/src/ReactFiberHotReloading.old.js
+1
@@ -191,6 +191,7 @@ export function isCompatibleFamilyForHotReloading(
191
// then we would risk falsely saying two separate memo(Foo)
192
// calls are equivalent because they wrap the same Foo function.
193
const prevFamily = resolveFamily(prevType);
194
+ // $FlowFixMe[not-a-function] found when upgrading Flow
195
if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
196
return true;
197
}
packages/react-reconciler/src/ReactFiberSyncTaskQueue.new.js
+2
@@ -60,7 +60,9 @@ export function flushSyncCallbacks(): null {
60
// TODO: Is this necessary anymore? The only user code that runs in this
61
// queue is in the render or commit phases.
62
setCurrentUpdatePriority(DiscreteEventPriority);
63
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
64
for (; i < queue.length; i++) {
65
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
66
let callback = queue[i];
67
do {
68
callback = callback(isSync);
packages/react-reconciler/src/ReactFiberSyncTaskQueue.old.js
+2
@@ -60,7 +60,9 @@ export function flushSyncCallbacks(): null {
60
// TODO: Is this necessary anymore? The only user code that runs in this
61
// queue is in the render or commit phases.
62
setCurrentUpdatePriority(DiscreteEventPriority);
63
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
64
for (; i < queue.length; i++) {
65
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
66
let callback = queue[i];
67
do {
68
callback = callback(isSync);
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+8
-1
@@ -415,6 +415,7 @@ export function addMarkerProgressCallbackToPendingTransition(
415
}
416
417
if (currentPendingTransitionCallbacks.markerProgress === null) {
418
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
419
currentPendingTransitionCallbacks.markerProgress = new Map();
420
}
421
@@ -443,6 +444,7 @@ export function addMarkerIncompleteCallbackToPendingTransition(
444
}
445
446
if (currentPendingTransitionCallbacks.markerIncomplete === null) {
447
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
448
currentPendingTransitionCallbacks.markerIncomplete = new Map();
449
}
450
@@ -470,6 +472,7 @@ export function addMarkerCompleteCallbackToPendingTransition(
472
}
473
474
if (currentPendingTransitionCallbacks.markerComplete === null) {
475
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
476
currentPendingTransitionCallbacks.markerComplete = new Map();
477
}
478
@@ -497,6 +500,7 @@ export function addTransitionProgressCallbackToPendingTransition(
500
}
501
502
if (currentPendingTransitionCallbacks.transitionProgress === null) {
503
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
504
currentPendingTransitionCallbacks.transitionProgress = new Map();
505
}
506
@@ -1670,7 +1674,8 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber {
1674
if (workInProgress !== null) {
1675
let interruptedWork = workInProgressIsSuspended
1676
? workInProgress
1673
- : workInProgress.return;
1677
+ : // $FlowFixMe[incompatible-use] found when upgrading Flow
1678
+ workInProgress.return;
1679
while (interruptedWork !== null) {
1680
const current = interruptedWork.alternate;
1681
unwindInterruptedWork(
@@ -3052,10 +3057,12 @@ export function attachPingListener(
3057
pingCache.set(wakeable, threadIDs);
3058
}
3059
}
3060
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
3061
if (!threadIDs.has(lanes)) {
3062
workInProgressRootDidAttachPingListener = true;
3063
3064
// Memoize using the thread ID to prevent redundant listeners.
3065
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
3066
threadIDs.add(lanes);
3067
const ping = pingSuspendedRoot.bind(null, root, wakeable, lanes);
3068
if (enableUpdaterTracking) {
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+8
-1
@@ -415,6 +415,7 @@ export function addMarkerProgressCallbackToPendingTransition(
415
}
416
417
if (currentPendingTransitionCallbacks.markerProgress === null) {
418
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
419
currentPendingTransitionCallbacks.markerProgress = new Map();
420
}
421
@@ -443,6 +444,7 @@ export function addMarkerIncompleteCallbackToPendingTransition(
444
}
445
446
if (currentPendingTransitionCallbacks.markerIncomplete === null) {
447
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
448
currentPendingTransitionCallbacks.markerIncomplete = new Map();
449
}
450
@@ -470,6 +472,7 @@ export function addMarkerCompleteCallbackToPendingTransition(
472
}
473
474
if (currentPendingTransitionCallbacks.markerComplete === null) {
475
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
476
currentPendingTransitionCallbacks.markerComplete = new Map();
477
}
478
@@ -497,6 +500,7 @@ export function addTransitionProgressCallbackToPendingTransition(
500
}
501
502
if (currentPendingTransitionCallbacks.transitionProgress === null) {
503
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
504
currentPendingTransitionCallbacks.transitionProgress = new Map();
505
}
506
@@ -1670,7 +1674,8 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber {
1674
if (workInProgress !== null) {
1675
let interruptedWork = workInProgressIsSuspended
1676
? workInProgress
1673
- : workInProgress.return;
1677
+ : // $FlowFixMe[incompatible-use] found when upgrading Flow
1678
+ workInProgress.return;
1679
while (interruptedWork !== null) {
1680
const current = interruptedWork.alternate;
1681
unwindInterruptedWork(
@@ -3052,10 +3057,12 @@ export function attachPingListener(
3057
pingCache.set(wakeable, threadIDs);
3058
}
3059
}
3060
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
3061
if (!threadIDs.has(lanes)) {
3062
workInProgressRootDidAttachPingListener = true;
3063
3064
// Memoize using the thread ID to prevent redundant listeners.
3065
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
3066
threadIDs.add(lanes);
3067
const ping = pingSuspendedRoot.bind(null, root, wakeable, lanes);
3068
if (enableUpdaterTracking) {
packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js
+2
@@ -159,7 +159,9 @@ export default class ReactFlightWebpackPlugin {
159
clientFileNameFound = true;
160
161
if (resolvedClientReferences) {
162
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
163
for (let i = 0; i < resolvedClientReferences.length; i++) {
164
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
165
const dep = resolvedClientReferences[i];
166
167
const chunkName = _this.chunkName
packages/react-server/src/ReactFizzHooks.js
+10
@@ -182,6 +182,7 @@ function createWorkInProgressHook(): Hook {
182
if (workInProgressHook.next === null) {
183
isReRender = false;
184
// Append to the end of the list
185
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
186
workInProgressHook = workInProgressHook.next = createHook();
187
} else {
188
// There's already a work-in-progress. Reuse it.
@@ -339,7 +340,9 @@ export function useReducer<S, I, A>(
340
// Render phase updates are stored in a map of queue -> linked list
341
const firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
342
if (firstRenderPhaseUpdate !== undefined) {
343
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
344
renderPhaseUpdates.delete(queue);
345
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
346
let newState = workInProgressHook.memoizedState;
347
let update = firstRenderPhaseUpdate;
348
do {
@@ -357,11 +360,13 @@ export function useReducer<S, I, A>(
360
update = update.next;
361
} while (update !== null);
362
363
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
364
workInProgressHook.memoizedState = newState;
365
366
return [newState, dispatch];
367
}
368
}
369
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
370
return [workInProgressHook.memoizedState, dispatch];
371
} else {
372
if (__DEV__) {
@@ -381,7 +386,9 @@ export function useReducer<S, I, A>(
386
if (__DEV__) {
387
isInHookUserCodeInDev = false;
388
}
389
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
390
workInProgressHook.memoizedState = initialState;
391
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
392
const queue: UpdateQueue<A> = (workInProgressHook.queue = {
393
last: null,
394
dispatch: null,
@@ -391,6 +398,7 @@ export function useReducer<S, I, A>(
398
currentlyRenderingComponent,
399
queue,
400
): any));
401
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
402
return [workInProgressHook.memoizedState, dispatch];
403
}
404
}
@@ -420,6 +428,7 @@ function useMemo<T>(nextCreate: () => T, deps: Array<mixed> | void | null): T {
428
if (__DEV__) {
429
isInHookUserCodeInDev = false;
430
}
431
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
432
workInProgressHook.memoizedState = [nextValue, nextDeps];
433
return nextValue;
434
}
@@ -483,6 +492,7 @@ function dispatchAction<A>(
492
}
493
const firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
494
if (firstRenderPhaseUpdate === undefined) {
495
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
496
renderPhaseUpdates.set(queue, update);
497
} else {
498
// Append the update to the end of the list.
packages/react-server/src/ReactFlightHooks.js
+1
@@ -83,6 +83,7 @@ export const Dispatcher: DispatcherType = {
83
if (entry === undefined) {
84
entry = resourceType();
85
// TODO: Warn if undefined?
86
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
87
currentCache.set(resourceType, entry);
88
}
89
return entry;
packages/react-server/src/ReactServerStreamConfigNode.js
+1
@@ -73,6 +73,7 @@ function writeStringChunk(destination: Destination, stringChunk: string) {
73
if (read < stringChunk.length) {
74
writeToDestination(destination, (currentView: any));
75
currentView = new Uint8Array(VIEW_SIZE);
76
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
77
writtenBytes = textEncoder.encodeInto(stringChunk.slice(read), currentView)
78
.written;
79
}
packages/react-test-renderer/src/ReactTestRenderer.js
+1
@@ -593,6 +593,7 @@ function create(
593
} else {
594
// However, we give you the root if there's more than one root child.
595
// We could make this the behavior for all cases but it would be a breaking change.
596
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
597
return wrapFiber(root.current);
598
}
599
},
packages/react/src/ReactStartTransition.js
+1
@@ -20,6 +20,7 @@ export function startTransition(
20
const currentTransition = ReactCurrentBatchConfig.transition;
21
22
if (__DEV__) {
23
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
24
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
25
}
26
packages/scheduler/src/SchedulerProfiling.js
+1
@@ -47,6 +47,7 @@ function logEvent(entries) {
47
return;
48
}
49
const newEventLog = new Int32Array(eventLogSize * 4);
50
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
51
newEventLog.set(eventLog);
52
eventLogBuffer = newEventLog.buffer;
53
eventLog = newEventLog;
packages/scheduler/src/forks/Scheduler.js
+12
@@ -183,7 +183,9 @@ function flushWork(hasTimeRemaining, initialTime) {
183
} catch (error) {
184
if (currentTask !== null) {
185
const currentTime = getCurrentTime();
186
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
187
markTaskErrored(currentTask, currentTime);
188
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
189
currentTask.isQueued = false;
190
}
191
throw error;
@@ -218,12 +220,17 @@ function workLoop(hasTimeRemaining, initialTime) {
220
// This currentTask hasn't expired, and we've reached the deadline.
221
break;
222
}
223
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
224
const callback = currentTask.callback;
225
if (typeof callback === 'function') {
226
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
227
currentTask.callback = null;
228
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
229
currentPriorityLevel = currentTask.priorityLevel;
230
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
231
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
232
if (enableProfiling) {
233
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
234
markTaskRun(currentTask, currentTime);
235
}
236
const continuationCallback = callback(didUserCallbackTimeout);
@@ -231,15 +238,19 @@ function workLoop(hasTimeRemaining, initialTime) {
238
if (typeof continuationCallback === 'function') {
239
// If a continuation is returned, immediately yield to the main thread
240
// regardless of how much time is left in the current time slice.
241
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
242
currentTask.callback = continuationCallback;
243
if (enableProfiling) {
244
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
245
markTaskYield(currentTask, currentTime);
246
}
247
advanceTimers(currentTime);
248
return true;
249
} else {
250
if (enableProfiling) {
251
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
252
markTaskCompleted(currentTask, currentTime);
253
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
254
currentTask.isQueued = false;
255
}
256
if (currentTask === peek(taskQueue)) {
@@ -564,6 +575,7 @@ const performWorkUntilDeadline = () => {
575
// `hasMoreWork` will remain true, and we'll continue the work loop.
576
let hasMoreWork = true;
577
try {
578
+ // $FlowFixMe[not-a-function] found when upgrading Flow
579
hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
580
} finally {
581
if (hasMoreWork) {
packages/scheduler/src/forks/SchedulerMock.js
+14
@@ -169,7 +169,9 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) {
169
} catch (error) {
170
if (currentTask !== null) {
171
const currentTime = getCurrentTime();
172
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
173
markTaskErrored(currentTask, currentTime);
174
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
175
currentTask.isQueued = false;
176
}
177
throw error;
@@ -204,12 +206,17 @@ function workLoop(hasTimeRemaining, initialTime: number): boolean {
206
// This currentTask hasn't expired, and we've reached the deadline.
207
break;
208
}
209
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
210
const callback = currentTask.callback;
211
if (typeof callback === 'function') {
212
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
213
currentTask.callback = null;
214
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
215
currentPriorityLevel = currentTask.priorityLevel;
216
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
217
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
218
if (enableProfiling) {
219
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
220
markTaskRun(currentTask, currentTime);
221
}
222
const continuationCallback = callback(didUserCallbackTimeout);
@@ -217,8 +224,10 @@ function workLoop(hasTimeRemaining, initialTime: number): boolean {
224
if (typeof continuationCallback === 'function') {
225
// If a continuation is returned, immediately yield to the main thread
226
// regardless of how much time is left in the current time slice.
227
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
228
currentTask.callback = continuationCallback;
229
if (enableProfiling) {
230
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
231
markTaskYield(currentTask, currentTime);
232
}
233
advanceTimers(currentTime);
@@ -233,7 +242,9 @@ function workLoop(hasTimeRemaining, initialTime: number): boolean {
242
}
243
} else {
244
if (enableProfiling) {
245
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
246
markTaskCompleted(currentTask, currentTime);
247
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
248
currentTask.isQueued = false;
249
}
250
if (currentTask === peek(taskQueue)) {
@@ -509,6 +520,7 @@ function unstable_flushNumberOfYields(count: number): void {
520
try {
521
let hasMoreWork = true;
522
do {
523
+ // $FlowFixMe[not-a-function] found when upgrading Flow
524
hasMoreWork = cb(true, currentMockTime);
525
} while (hasMoreWork && !didStop);
526
if (!hasMoreWork) {
@@ -534,6 +546,7 @@ function unstable_flushUntilNextPaint(): false {
546
try {
547
let hasMoreWork = true;
548
do {
549
+ // $FlowFixMe[not-a-function] found when upgrading Flow
550
hasMoreWork = cb(true, currentMockTime);
551
} while (hasMoreWork && !didStop);
552
if (!hasMoreWork) {
@@ -580,6 +593,7 @@ function unstable_flushAllWithoutAsserting(): boolean {
593
try {
594
let hasMoreWork = true;
595
do {
596
+ // $FlowFixMe[not-a-function] found when upgrading Flow
597
hasMoreWork = cb(true, currentMockTime);
598
} while (hasMoreWork);
599
if (!hasMoreWork) {
scripts/flow/config/flowconfig
+1
-1
@@ -50,4 +50,4 @@ munge_underscores=false
50
%REACT_RENDERER_FLOW_OPTIONS%
51
52
[version]
53
-^0.145.0
53
+^0.146.0
yarn.lock
+4
-4
@@ -7911,10 +7911,10 @@ flatted@^2.0.0:
7911
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
7912
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==
7913
7914
-flow-bin@^0.145.0:
7915
- version "0.145.0"
7916
- resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.145.0.tgz#922f7c3568caaa5eb64621ec536deb56b24d1795"
7917
- integrity sha512-+9fi9BMxRBtSWC1x0hWggWTb8Vih+AC7wyvLAX5wR1m6u2lF2HLtixXqy2GX8bWgaynSEJR5lmPxYYC4wMI8cA==
7914
+flow-bin@^0.146.0:
7915
+ version "0.146.0"
7916
+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.146.0.tgz#fafa002663a0e13bf3c08c3972dd93d68289ccc6"
7917
+ integrity sha512-TP8eCwltqc7fo6ad5klgsrZ2veZIK2qM1vHf1A/cnXTStPh8hLAz1cOXmlQIFZR/7fjSMI39TS3CgF6M/HUhAw==
7918
7919
fluent-syntax@0.13.0:
7920
version "0.13.0"