Page MenuHomePhabricator

[lib] Add containedThreadInfos selector
ClosedPublic

Authored by patryk on Jul 18 2023, 3:53 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 12:50 PM
Unknown Object (File)
Sat, Nov 23, 12:50 PM
Unknown Object (File)
Sat, Nov 23, 12:50 PM
Unknown Object (File)
Fri, Nov 1, 7:56 AM
Unknown Object (File)
Fri, Nov 1, 7:56 AM
Unknown Object (File)
Fri, Nov 1, 7:56 AM
Unknown Object (File)
Fri, Nov 1, 7:56 AM
Unknown Object (File)
Fri, Nov 1, 7:56 AM
Subscribers

Details

Summary

Part of ENG-4319.

A new selector is needed to obtain contained chats. There exists childThreadInfos selector, but it operates on parentThreadID rather than on containingThreadID.

Depends on D8686.

Test Plan

Tested later in the stack.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

patryk held this revision as a draft.
patryk edited the test plan for this revision. (Show Details)
patryk added reviewers: bartek, tomek, inka, kamil.
This revision is now accepted and ready to land.Jul 19 2023, 3:11 AM
bartek added inline comments.
lib/selectors/thread-selectors.js
212–214 ↗(On Diff #28770)

Do we rely on the difference between null and undefined here?

IIRC we do so below in result[containingThreadID]

lib/selectors/thread-selectors.js
203 ↗(On Diff #28770)

Would be best to avoid * here, which is basically any in modern versions of Flow.

  1. What happens if you try using mixed?
  2. Alternately, what happens if you make the following type updates:
    • Update lib/types/redux-types.js to specify a default value for the type param, eg. export type BaseAppState<NavInfo: BaseNavInfo = BaseNavInfo>
    • Use the default type param here: BaseAppState<>
211 ↗(On Diff #28770)
lib/selectors/thread-selectors.js
203 ↗(On Diff #28770)
  1. Error occurs: Cannot instantiate BaseAppState because mixed is incompatible with BaseNavInfo in type argument NavInfo [Flow(incompatible-type-arg)]
  2. We get prop missing, incompatible exact and variance errors:
property ... (e. g. activeChatThreadID)  is missing in  BaseNavInfo but exists in  NavInfo; 
property startDate is read-only in  BaseNavInfo but writable in  NavInfo; 
BaseNavInfo is incompatible with exact  NavInfo in property navInfo;

Unpack containingThreadID property.

ashoat requested changes to this revision.Jul 31 2023, 11:39 AM

I don't have much spare time, but I took a look at this for you

This is happening because navInfo is not read-only in AppState. This is exactly why we try to make everything read-only when possible. More details on this general class of problems here.

Please rebase your diff onto my stack: D8686

Then take out the *

This revision now requires changes to proceed.Jul 31 2023, 11:39 AM
This revision is now accepted and ready to land.Aug 1 2023, 6:28 AM
patryk retitled this revision from [web] Add containedThreadInfos selector to [lib] Add containedThreadInfos selector.Aug 2 2023, 3:44 AM
This revision was landed with ongoing or failed builds.Aug 2 2023, 3:02 PM
This revision was automatically updated to reflect the committed changes.