Page MenuHomePhabricator

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

Authored by kamil on Apr 25 2023, 10:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 6:20 PM
Unknown Object (File)
Tue, Nov 5, 2:11 AM
Unknown Object (File)
Sun, Oct 20, 11:11 AM
Unknown Object (File)
Oct 3 2024, 5:17 AM
Unknown Object (File)
Sep 27 2024, 3:35 PM
Unknown Object (File)
Sep 13 2024, 8:46 PM
Unknown Object (File)
Sep 13 2024, 8:46 PM
Unknown Object (File)
Sep 13 2024, 8:46 PM
Subscribers

Details

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

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable