mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-20 07:13:05 +00:00
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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user