markStale method

void markStale(
  1. Object key
)

Marks the query for key as stale without notifying active observers.

Unlike invalidate, this does not transition the entry to a Loading state and does not trigger an immediate refetch on mounted QoraBuilder widgets. The stale flag is consumed on the next fetchQuery or watchQuery mount: the SWR logic will then trigger a background revalidation while the UI continues to show the previous data.

// Mark stale silently; the widget refetches on its next mount/interaction.
client.markStale(['users', userId]);

Implementation

void markStale(Object key) {
  _assertNotDisposed();
  final normalized = normalizeKey(key);
  final sk = _stringKey(normalized);
  final entry = _cache.peek(normalized);
  if (entry != null) {
    entry.markStale();
    _tracker.onQueryMarkedStale(sk);
    _log('markStale: $normalized');
  }
}