Page MenuHomePhabricator

[keyserver] Improve Flow types in update-creator
ClosedPublic

Authored by tomek on Aug 9 2023, 6:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jun 11, 3:38 PM
Unknown Object (File)
Mon, Jun 10, 7:55 AM
Unknown Object (File)
Sat, Jun 8, 3:45 AM
Unknown Object (File)
Mon, Jun 3, 8:23 PM
Unknown Object (File)
Sat, May 18, 5:22 AM
Unknown Object (File)
Sat, May 18, 5:21 AM
Unknown Object (File)
Sat, May 18, 5:20 AM
Unknown Object (File)
Sat, May 18, 4:56 AM
Subscribers

Details

Summary

We had a type error and Flow was unable to detect that. This diff makes it so the type error would be reported and replaces false with null to satisfy type system. In fetchMessageInfos and parseMessageSelectionCriteria we're using threadCursors[threadID] in if conditions so it is safe to do that replacement.

https://linear.app/comm/issue/ENG-4592/improve-flow-types-in-update-creator

Test Plan

Console log messageInfoResult before and after change and check if the result remains correct.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested review of this revision.Aug 9 2023, 6:28 AM
kamil added inline comments.
keyserver/src/creators/update-creator.js
461 ↗(On Diff #29786)

Not sure if this will work, but if yes it seems safer

This revision is now accepted and ready to land.Aug 16 2023, 1:57 AM
keyserver/src/creators/update-creator.js
461 ↗(On Diff #29786)

It definitely would be safer but isn't possible because all the props of ThreadCursors are read-only.