Skip to content

Commit

Permalink
Flow upgrade to 0.155
Browse files Browse the repository at this point in the history
This version banned use of this in object functions.

ghstack-source-id: f49fd5e1b7732cea1ec75e71f2611f0ffa19e80d
Pull Request resolved: #25414
  • Loading branch information
kassens committed Oct 4, 2022
1 parent 8bc95bb commit 338e6a9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
"fbjs-scripts": "1.2.0",
"filesize": "^6.0.1",
"flow-bin": "^0.154.0",
"flow-bin": "^0.155.0",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",
"google-closure-compiler": "^20200517.0.0",
Expand Down
9 changes: 9 additions & 0 deletions packages/react-devtools-shared/src/backend/legacy/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,12 @@ export function attach(
const internalInstance = args[0];
const hostContainerInfo = args[3];
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}
if (hostContainerInfo._topLevelWrapper === undefined) {
// SSR
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}

Expand All @@ -241,6 +243,7 @@ export function attach(
);

try {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const result = fn.apply(this, args);
parentIDStack.pop();
return result;
Expand All @@ -260,6 +263,7 @@ export function attach(
performUpdateIfNecessary(fn, args) {
const internalInstance = args[0];
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}

Expand All @@ -268,6 +272,7 @@ export function attach(

const prevChildren = getChildren(internalInstance);
try {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const result = fn.apply(this, args);

const nextChildren = getChildren(internalInstance);
Expand All @@ -294,6 +299,7 @@ export function attach(
receiveComponent(fn, args) {
const internalInstance = args[0];
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}

Expand All @@ -302,6 +308,7 @@ export function attach(

const prevChildren = getChildren(internalInstance);
try {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const result = fn.apply(this, args);

const nextChildren = getChildren(internalInstance);
Expand All @@ -328,12 +335,14 @@ export function attach(
unmountComponent(fn, args) {
const internalInstance = args[0];
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return fn.apply(this, args);
}

const id = getID(internalInstance);
parentIDStack.push(id);
try {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const result = fn.apply(this, args);
parentIDStack.pop();

Expand Down
9 changes: 9 additions & 0 deletions packages/react-fetch/src/ReactFetchBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,36 @@ Response.prototype = {
constructor: Response,
arrayBuffer() {
return readRecordValue(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._arrayBuffer ||
// $FlowFixMe[object-this-reference] found when upgrading Flow
(this._arrayBuffer = createRecordFromThenable(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._response.arrayBuffer(),
)),
);
},
blob() {
return readRecordValue(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._blob ||
// $FlowFixMe[object-this-reference] found when upgrading Flow
(this._blob = createRecordFromThenable(this._response.blob())),
);
},
json() {
return readRecordValue(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._json ||
// $FlowFixMe[object-this-reference] found when upgrading Flow
(this._json = createRecordFromThenable(this._response.json())),
);
},
text() {
return readRecordValue(
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._text ||
// $FlowFixMe[object-this-reference] found when upgrading Flow
(this._text = createRecordFromThenable(this._response.text())),
);
},
Expand Down
9 changes: 9 additions & 0 deletions packages/react-fetch/src/ReactFetchNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ function Response(nativeResponse) {
Response.prototype = {
constructor: Response,
arrayBuffer() {
// $FlowFixMe[object-this-reference] found when upgrading Flow
const buffer = readRecordValue(this._bufferRecord);
return buffer;
},
Expand All @@ -151,20 +152,28 @@ Response.prototype = {
throw new Error('Not implemented.');
},
json() {
// $FlowFixMe[object-this-reference] found when upgrading Flow
if (this._json !== null) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return this._json;
}
// $FlowFixMe[object-this-reference] found when upgrading Flow
const buffer = readRecordValue(this._bufferRecord);
const json = JSON.parse(buffer.toString());
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._json = json;
return json;
},
text() {
// $FlowFixMe[object-this-reference] found when upgrading Flow
if (this._text !== null) {
// $FlowFixMe[object-this-reference] found when upgrading Flow
return this._text;
}
// $FlowFixMe[object-this-reference] found when upgrading Flow
const buffer = readRecordValue(this._bufferRecord);
const text = buffer.toString();
// $FlowFixMe[object-this-reference] found when upgrading Flow
this._text = text;
return text;
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/flow/config/flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ munge_underscores=false
%REACT_RENDERER_FLOW_OPTIONS%

[version]
^0.154.0
^0.155.0
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7912,10 +7912,10 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==

flow-bin@^0.154.0:
version "0.154.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.154.0.tgz#e086964398e671daa8f56ed8663d7876337f77e5"
integrity sha512-I6u2ETdkAyard+8C5na6bfZp4EM0zIMB7O5zH4GKzBLv9/y8/NYRTxEXQe5T0hvj9R9DxFBUoPsFK76ziweUFw==
flow-bin@^0.155.0:
version "0.155.1"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.155.1.tgz#1263ee3e0f42d11cb13ba56c3851a096213ce5f7"
integrity sha512-qy2eXkgngR6u+MYA1ydzPnclhos21BZlpkJ50Y9YOZ4eTMq6txswB3X+gUsg8XUyCteLoMeo7n30k7aY2no2Yw==

[email protected]:
version "0.13.0"
Expand Down

0 comments on commit 338e6a9

Please sign in to comment.