Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

document useAutoRefetch gotchas: don't catch-to-null in data callers, refetch bypasses visibility

[._.]/ Adam Eivy40d6c1f5cfd7
diff --git a/client/src/hooks/useAutoRefetch.js b/client/src/hooks/useAutoRefetch.js
index 892b0f52d6..b03f3ffe8d 100644
--- a/client/src/hooks/useAutoRefetch.js
+++ b/client/src/hooks/useAutoRefetch.js
@@ -11,6 +11,16 @@ import { useVisibilityEvent } from './useVisibilityEvent.js';
* ignore the hook's `data` return; that's fine, but be aware the hook will
* still set `data = null` on each tick.
*
+ * Data-path callers (those reading the returned `data`) should NOT swallow
+ * errors with `.catch(() => null)` — the hook will then apply that null and
+ * wipe the previously-displayed snapshot on every transient blip. Let the
+ * error throw; the hook's catch logs it and preserves the last good data.
+ *
+ * `refetch` is intentionally unconditional — it bypasses the hidden-tab
+ * short-circuit so explicit "Refresh" buttons work regardless of visibility.
+ * Don't call it from effects that fire on mount/route change without a
+ * visibility gate, or the "pauses while hidden" guarantee leaks.
+ *
* @param {Function} fetchFn - async, returns the new data
* @param {number} intervalMs - poll cadence; changing restarts the interval
* @param {Object} [options]