HomePhabricator
Diffusion Comm 60cffd07793a

[Flow202][lib][skip-ci] [18/23] Fix Flow issues in lib/socket

Description

[Flow202][lib][skip-ci] [18/23] Fix Flow issues in lib/socket

Summary:
These errors were mostly cases with React class components, where the new version of Flow wants a return type on every function defined in the class.

There were two exceptions:

  1. Flow didn't like us checking request.endpoint when request could be falsey, even though request was checked right before. Solved this by replacing the check with the optional chaining operator.
  2. In inflight-requests.js, Flow didn't like that we were checking the value of this.clearRequest before an await... Flow was afraid the value could change during the await. I fixed this by assigning the value to a local variable before checking it.
NOTE: CI will fail on this diff. I considered the possibility of fixing Flow errors BEFORE upgrading Flow, but it wasn't possible... in some cases, the fixes to support the new version of Flow caused errors in the old version. I could have hidden these type errors with $FlowFixMe lines and then later revert those, but that seemed like too much busy work.

Depends on D9709

Test Plan: Confirm the Flow errors go away

Reviewers: atul

Reviewed By: atul

Subscribers: tomek, wyilio

Differential Revision: https://phab.comm.dev/D9710

Details

Provenance
ashoatAuthored on Nov 4 2023, 11:19 AM
Reviewer
atul
Differential Revision
D9710: [Flow202][lib][skip-ci] [18/23] Fix Flow issues in lib/socket
Parents
rCOMMcb05151269f2: [Flow202][lib][skip-ci] [17/23] Fix Flow issues in lib/shared/state-sync
Branches
Unknown
Tags
Unknown