HomePhabricator
Diffusion Comm b535e8b536a8

[lib] update message store threads in SQLite after setting client DB store

Description

[lib] update message store threads in SQLite after setting client DB store

Summary:
This adds a missing part of updating message store threads after getting all data from the database. This handle rare case when there is a message but without threadID entry in threads.

Note: This is a different approach than in the rest of the code.
In general, we create ops, and use these ops for updating both state and DB (ops are later converted to database and passed to CommCoreModule).
Here, we compute messageIDs based on data from messages table - that being said each thread will be updated and will have updated only messageIDs fields. Since messageIDs are not persisted, this will cause an unnecessary updates of all threads, but with the same values which is a lot of useless computation.
To avoid this, creating an operation only for adding a new thread that is not present in the database yet.

In this case, asserting equal states makes no sense.

Depends on D7612

Test Plan: Close and open app multiple times to call this code and check if comparing this with redux-persist is not failing

Reviewers: tomek, marcin, michal

Reviewed By: marcin

Subscribers: ashoat, atul

Differential Revision: https://phab.comm.dev/D7613

Details