Page MenuHomePhabricator

[native] Add `messageStoreLoaded` to `SQLiteContext`
ClosedPublic

Authored by atul on May 31 2022, 6:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 11, 3:57 PM
Unknown Object (File)
Nov 14 2024, 4:40 PM
Unknown Object (File)
Nov 13 2024, 10:52 AM
Unknown Object (File)
Nov 13 2024, 10:52 AM
Unknown Object (File)
Nov 7 2024, 8:00 PM
Unknown Object (File)
Nov 7 2024, 6:45 PM
Unknown Object (File)
Nov 7 2024, 6:13 PM
Unknown Object (File)
Nov 7 2024, 3:20 PM

Details

Summary

We use SQLiteContext to determine whether the state persisted in SQLite has been loaded.

For example, in app-navigator, we won't render within App.Navigator until storeLoadedFromLocalDatabase is true.


Depends on D4158

Test Plan

We're manually setting messageStoreLoaded to true in SQLiteContextProvider for persistConfig.version < 31 (the migration which "flips the switch") for now.

The app should continue to work as expected without issue. Specifically, will deploy a release build to my phone and open/force quit/open/etc the app a couple times and make sure things continue to work as expected.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.May 31 2022, 6:28 AM
tomek added inline comments.
native/navigation/app-navigator.react.js
169–170 ↗(On Diff #13231)

Maybe localDatabaseContext should expose a value storesLoaded that is true when every store was loaded? Currently we have two places where we check localDatabaseContext?.threadStoreLoaded && localDatabaseContext?.messageStoreLoaded so it might be a good idea to move this to a common place.

This revision is now accepted and ready to land.Jun 1 2022, 7:33 AM
native/navigation/app-navigator.react.js
169–170 ↗(On Diff #13231)

I think that makes sense. I didn't spend too much time looking closely at app-navigator.react.js yet, but I think we should be able to use usePersistedStateLoaded() or create an equivalent hook. I can imagine if one day we are persisting more of the redux state in SQLite that this could get really long

rebase after cherrypick and before landing