fix: do not listen for store updates in isolates (#21947)

* dispose store on isolate cleanup

* do not listen for store updates in isolates

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
shenlong 2025-09-15 01:20:17 +05:30 committed by GitHub
parent 2dcb32f7d0
commit b26b452530
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 29 additions and 15 deletions

View file

@ -89,11 +89,17 @@ abstract final class Bootstrap {
return (isar, drift, logDb);
}
static Future<void> initDomain(Isar db, Drift drift, DriftLogger logDb, {bool shouldBufferLogs = true}) async {
static Future<void> initDomain(
Isar db,
Drift drift,
DriftLogger logDb, {
bool listenStoreUpdates = true,
bool shouldBufferLogs = true,
}) async {
final isBeta = await IsarStoreRepository(db).tryGet(StoreKey.betaTimeline) ?? true;
final IStoreRepository storeRepo = isBeta ? DriftStoreRepository(drift) : IsarStoreRepository(db);
await StoreService.init(storeRepository: storeRepo);
await StoreService.init(storeRepository: storeRepo, listenUpdates: listenStoreUpdates);
await LogService.init(
logRepository: LogRepository(logDb),