refactor: centralize conversation cache management
- Introduced a new method `refreshConversationsCache` to streamline the invalidation of the conversations provider and optionally the folders provider. - Updated various components to utilize the new cache management method, enhancing code clarity and reducing redundancy. - This refactor improves the efficiency of conversation and folder synchronization across the application.
This commit is contained in:
@@ -103,7 +103,7 @@ void _scheduleConversationWarmup(Ref ref, {bool force = false}) {
|
||||
return;
|
||||
}
|
||||
if (existing.hasError) {
|
||||
ref.invalidate(conversationsProvider);
|
||||
refreshConversationsCache(ref);
|
||||
}
|
||||
final conversations = await ref.read(conversationsProvider.future);
|
||||
statusController.set(_ConversationWarmupStatus.complete);
|
||||
@@ -368,7 +368,7 @@ class _ForegroundRefreshObserver extends WidgetsBindingObserver {
|
||||
// Schedule to avoid side-effects during build frames
|
||||
Future.microtask(() {
|
||||
try {
|
||||
_ref.invalidate(conversationsProvider);
|
||||
refreshConversationsCache(_ref);
|
||||
_ref
|
||||
.read(_conversationWarmupStatusProvider.notifier)
|
||||
.set(_ConversationWarmupStatus.idle);
|
||||
|
||||
Reference in New Issue
Block a user