[lib] Introduce pendingToRealizedThreadIDsSelector
Summary:
In both D891 and D926 we have a need to convert pending thread IDs to the "realized" thread IDs once the thread is created. We have existing logic to map between these things, but the existing logic relies on Hooks and on the full Redux state.
In this diff I introduce pendingToRealizedThreadIDsSelector. It is a reselect selector that takes rawThreadInfos as input, which allows it to be accessed from D891 and D926 while avoiding recomputation. We can compute the collection just once for each rawThreadInfos state, and use that resultant collection both in the existing business logic as well as in reducers.
I also went ahead and refactored existing code to go through pendingToRealizedThreadIDsSelector so we avoid duplicating code.
Test Plan: Flow
Reviewers: palys-swm, KatPo
Reviewed By: palys-swm, KatPo
Subscribers: zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D943