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)
Sun, Nov 10, 3:58 PM
Unknown Object (File)
Sun, Nov 10, 3:58 PM
Unknown Object (File)
Sun, Nov 10, 3:58 PM
Unknown Object (File)
Tue, Nov 5, 2:12 AM
Unknown Object (File)
Oct 6 2024, 3:00 PM
Unknown Object (File)
Oct 4 2024, 10:02 AM
Unknown Object (File)
Oct 4 2024, 10:02 AM
Unknown Object (File)
Oct 4 2024, 10:01 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.