feat(notifications): add per-node filter and 60s refetch safety net (#717)

Two polish improvements to the aggregated notifications inbox:

- Per-node filter dropdown in the bell panel (hidden on single-node
  installs) so fleet operators can triage events from a specific box.
  Selected node falls back to "All nodes" automatically if that node is
  removed from the registry.
- 60-second safety-net poll that reconciles the list so events missed
  during a WebSocket reconnect backoff appear without a manual refresh.
  Uses a ref indirection to pin the interval to the latest
  fetchNotifications closure.
This commit is contained in:
Anso
2026-04-20 21:37:34 -04:00
committed by GitHub
parent 08f57c7141
commit 3e1fb76bd0
2 changed files with 74 additions and 6 deletions
+11
View File
@@ -817,6 +817,17 @@ export default function EditorLayout() {
}
};
// Safety-net poll: reconciles the list every 60s so events missed during a
// WebSocket reconnect backoff still appear without a manual refresh. The ref
// indirection keeps the interval pinned to the latest closure even though
// fetchNotifications is redefined on every render.
const fetchNotificationsRef = useRef(fetchNotifications);
fetchNotificationsRef.current = fetchNotifications;
useEffect(() => {
const id = setInterval(() => { fetchNotificationsRef.current(); }, 60_000);
return () => clearInterval(id);
}, []);
const fetchImageUpdates = async () => {
try {
const res = await apiFetch('/image-updates');