[lib] Create a queue and use it to process queued operations
Summary:
It is possible that we need an updated state when processing the next operation, so we need to make sure that the new state is propagated.
https://linear.app/comm/issue/ENG-9470/mitigate-risks-of-effects-running-on-outdated-data
Test Plan:
Tested that this diff doesn't introduce a regression:
- Receiving an edit entry operation before create entry
- Receiving a change thread settings operation before create thread
- Receiving a change thread subscription before adding as a member
Each of these produces the correct state and clears the Redux queue.
Also tested that we have a bug that this diff fixes. Created three operations that were processed in the following order:
- Change thread name at timestamp T+1
- Change thread description at T+1
- Create thread at T
Before this diff, there were robotexts displayed for each of these, but the thread name wasn't changed. After this diff both thread name and description are updated.
Reviewers: kamil, ashoat
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D13572