HomePhabricator
Diffusion Comm 362d8fb1c778

[Flow202][web][skip-ci] [14/x] Fix Flow issues in web/database

Description

[Flow202][web][skip-ci] [14/x] Fix Flow issues in web/database

Summary:
Flow is worried about these variables being reassigned between await invocations.

I had three options:

  1. Assign them to local const variables to guarantee that they aren't reassigned. This is what I opted to do. However, note that this may lead to some changes in behavior, particularly if the code here relied on getting the "latest" value assigned to the variable, rather than using the value that was there at the start of the invocation.
  2. Add invariants. This would make sense if we always want to use the "latest" value AND we're sure that it will never be unset after the first time it's set.
  3. Add checks / error handling if the variable is not set at the time it's called. This would probably be the safest thing to do, but should only be necessary if we want to use the "latest" value AND there's a possibility of the variable being unset after the first time it's set.
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 D9779

Test Plan: Confirm the Flow errors go away

Reviewers: kamil, michal

Reviewed By: kamil

Subscribers: tomek, wyilio

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

Details