refetchScope method

Future<void> refetchScope(
  1. String scopeId
)

Refetch all queries in a specific scope

Implementation

Future<void> refetchScope(String scopeId) async {
  final scopeQueries = _scopeQueries[scopeId];
  if (scopeQueries == null) return;

  final refetchFutures = <Future>[];
  for (final key in scopeQueries) {
    final query = _queries[key];
    if (query != null && !query.isDisposed) {
      refetchFutures.add(query.refetch().catchError((e) {
        ZenLogger.logWarning(
          'Failed to refetch query $key in scope $scopeId: $e',
        );
      }));
    }
  }

  await Future.wait(refetchFutures);
  ZenLogger.logDebug(
      'Refetched ${refetchFutures.length} queries in scope: $scopeId');
}