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 10, 2025
1 parent f4032fd commit ca51f78
Show file tree
Hide file tree
Showing 2 changed files with 476 additions and 69 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
Loading

0 comments on commit ca51f78

Please sign in to comment.