[Flow202][keyserver][skip-ci] [16/x] Address type errors in message-fetchers.js
Summary:
The Flow update forced me to type MessageSQLResultRow here, which surfaced some issues. Separating this diff out since there are some non-Flow changes:
- Added an invariant that should never trigger: collapseQuery results should all have collapse_key.
- Added an if (!row.id) continue to parseMessageSQLResult. This is necessary because technically id is nullable – in fetchCollapsableNotifs, if a notif points to a message that is missing in the messages table, this can happen. In that case we will just skip that message when fetching the collapsable notifs.
- Stripped some awaits that were in front of parseMessageSQLResult (which doesn't return a Promise).
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 D9864
Test Plan: Confirm the Flow errors go away
Reviewers: rohan, inka, michal
Reviewed By: michal
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D9865