Page MenuHomePhabricator

[lib][native][web] Extract chatMessageItemKey
ClosedPublic

Authored by ashoat on Oct 9 2024, 8:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 9:06 PM
Unknown Object (File)
Sun, Nov 10, 8:46 PM
Unknown Object (File)
Sun, Nov 10, 7:05 PM
Unknown Object (File)
Sun, Nov 10, 7:44 AM
Unknown Object (File)
Sun, Nov 10, 7:19 AM
Unknown Object (File)
Thu, Nov 7, 12:41 PM
Unknown Object (File)
Thu, Oct 31, 1:28 AM
Unknown Object (File)
Wed, Oct 30, 5:26 PM
Subscribers
None

Details

Summary

This will make it easier to change its behavior in a later diff.

Depends on D13681

Test Plan

Flow

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat requested review of this revision.Oct 9 2024, 9:43 PM
tomek added inline comments.
lib/shared/chat-message-item-utils.js
19–27 ↗(On Diff #45041)

Do we need to specify messageInfos here?

This revision is now accepted and ready to land.Oct 11 2024, 6:06 AM
lib/shared/chat-message-item-utils.js
19–27 ↗(On Diff #45041)

Yes, it's necessary. Without explicitly listing messageInfos here, Flow deduces that the ... can contain messageInfos. As a result, Flow isn't able to narrow the type when we do a check like this:

if (item.messageInfos) {
  ...
}