[lib] Fix missing thread bug in updateRelationshipsAndSendRobotext()
Summary:
Fixes https://linear.app/comm/issue/ENG-9946/cannot-read-properties-of-undefined-reading-members
In createThickThreadAndSendRobotextPromise there are two called two functions: createNewThickThread and sendRobotextToThickThread. After the thread is created, sendRobotextToThickThread is called but it’s an outdated reference that was captured before createNewThickThread is called and it uses old threads storage without the new thread.
The fix is inspired by "step-based approach" in the codebase but modified so that it allows for waiting for multiple threads at once.
Depends on D14187 but just for testing
Test Plan:
Go to Profile -> Friend list
Select 1 or more users and add them as friends
Click Save
Verify that the requests are sent and there is no longer an error in the logs about missing thread
Reviewers: tomek, kamil
Reviewed By: tomek
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D14188