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, Apr 3, 4:17 PM
Unknown Object (File)
Wed, Apr 3, 4:17 PM
Unknown Object (File)
Wed, Apr 3, 4:13 PM
Unknown Object (File)
Mar 28 2024, 8:02 PM
Unknown Object (File)
Feb 23 2024, 1:00 AM
Unknown Object (File)
Feb 18 2024, 5:56 PM
Unknown Object (File)
Feb 18 2024, 3:46 PM
Unknown Object (File)
Feb 18 2024, 2:08 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