Fix cache synchronizing side effect when open folder

This commit is contained in:
Dat PHAM HOANG
2025-01-09 17:50:25 +07:00
committed by Dat H. Pham
parent dc3f3b56e6
commit 262cf278ba
2 changed files with 482 additions and 75 deletions
@@ -96,15 +96,17 @@ class ThreadRepositoryImpl extends ThreadRepository {
await _updateEmailCache(accountId, session.username, newCreated: networkEmailResponse.emailList);
}
if (localEmailResponse.hasState() && getLatestChanges) {
if (localEmailResponse.hasState()) {
log('ThreadRepositoryImpl::getAllEmail(): filter = ${emailFilter?.mailboxId} local has state: ${localEmailResponse.state}');
await _synchronizeCacheWithChanges(
session,
accountId,
localEmailResponse.state!,
propertiesCreated: propertiesCreated,
propertiesUpdated: propertiesUpdated
);
if (getLatestChanges) {
await _synchronizeCacheWithChanges(
session,
accountId,
localEmailResponse.state!,
propertiesCreated: propertiesCreated,
propertiesUpdated: propertiesUpdated
);
}
} else {
if (networkEmailResponse != null) {
log('ThreadRepositoryImpl::getAllEmail(): filter = ${emailFilter?.mailboxId} no local state -> update from network: ${networkEmailResponse.state}');