Skip to content

Commit

Permalink
Fix cache synchronizing side effect when open folder
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdat committed Jan 9, 2025
1 parent f4032fd commit 199a65f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/features/thread/data/repository/thread_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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}');
Expand Down

0 comments on commit 199a65f

Please sign in to comment.