Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Retire notification recovery callbacks with their view

pulse-triage[bot]27f24b3c5dfc
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index def6dc41b6..26231a8eba 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -4712,3 +4712,27 @@ provider, mask, routing and off-state behaviour;
`src/utils/__tests__/alertEmailPresentation.test.ts` covers the retry explanation.
Browser proof uses the production email panel, destination state, API and CSS
with synthetic local endpoints. It is not native SMTP delivery or a release.
+
+### Notification recovery belongs to its mounted view
+
+Overview and Notifications retire their delivery-health/recovery owner on
+unmount. Late health success, failure and loading completion cannot update
+that owner. Late Retry/Dismiss completion cannot publish a global toast,
+change its feedback or start health/activity readbacks after the view retires.
+A callback scheduled before retirement is checked again before invocation;
+already-started activity failures cannot restore retired feedback. Calls to
+retired health/action/clear handlers do nothing, including no confirmation.
+
+An already-dispatched mutation or read is not cancelled, undone or declared
+failed by navigation. Active views retain the existing confirmation,
+acknowledgement, read ordering and persistent failure feedback. A replacement
+view owns its independent read and any deliberately confirmed action; source
+checks do not establish notification delivery or installed queue recovery.
+
+`useNotificationDeliveryHealth.lifecycle.test.tsx` covers pending reads and
+both actions, callback scheduling/completion and retired entry points.
+`useAlertDestinationsTabState.test.tsx` connects both actions to the real
+Notifications owner, proving a late result cannot notify or start readbacks
+in its replacement while the replacement's own action still works. Browser
+controls use the actual Overview/Notifications components, API adapters,
+toast and CSS with synthetic local endpoints at desktop/phone widths.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index d95f1cb6bc..07168babfd 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -9212,3 +9212,20 @@ explains that Pulse manages retries; supported SMTP, TLS, rate-limit, routing
and off-state editing remain unchanged. Destination payload builders still
discard unsupported fields from stale drafts. Component, helper, destination
and local browser controls cover the boundary; they do not prove SMTP delivery.
+
+### Notification recovery callbacks retire with their view
+
+The shared delivery-health owner used by Overview and Notifications ignores
+pending health/action/activity completions after unmount. It cannot show a
+late global toast, restore retired local feedback or initiate post-action
+health/activity reads in a replacement view. Retired entry points do not
+confirm or dispatch an action. Unmount does not cancel or undo a previously
+issued request; active views retain their existing confirmation, latest-read
+ownership and persistent action-failure feedback.
+
+Verification: `useNotificationDeliveryHealth.lifecycle.test.tsx` and the
+connected `useAlertDestinationsTabState.test.tsx` cover both queue actions,
+retired reads/callbacks and a replacement owner's independent accepted action.
+Desktop/phone browser controls use the real Overview/Notifications surfaces,
+API adapters, toast and CSS with synthetic responses, not native delivery or
+published queue recovery.
diff --git a/frontend-modern/browser-verification/8828240b03ad4d4f.json b/frontend-modern/browser-verification/8828240b03ad4d4f.json
new file mode 100644
index 0000000000..d42ca81e69
--- /dev/null
+++ b/frontend-modern/browser-verification/8828240b03ad4d4f.json
@@ -0,0 +1,38 @@
+{
+ "version": 1,
+ "base_sha": "7b53ea4875876c34073f11e9b8981a777a07415f",
+ "verified_at": "2026-10-10T15:16:17.187928Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/alerts/useNotificationDeliveryHealth.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/alerts/useNotificationDeliveryHealth.ts": "24a988a118bf3040647ea82b53d3ee1b35fb332d1c6349919d0173c3b986a75e"
+ },
+ "routes": [
+ "/tmp/notification-lifetime/index.html?surface=overview",
+ "/tmp/notification-lifetime/index.html?surface=destinations"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 900
+ }
+ ],
+ "states": [
+ "20 final synthetic-response controls use the real existing Overview/Notifications components, hooks, API adapters, toast and CSS. Desktop Chromium 141.0.7390.37/light and phone WebKit 26.0/dark; Playwright 1.56.1 matches the integration lock.",
+ "Both Retry and Dismiss, accepted and rejected while pending, then view replacement: no late toast/feedback or new health/activity GET; the replacement remains independently healthy. Pending controls are disabled and one confirmation leads to one synthetic POST.",
+ "Active-view accepted Retry retains its acknowledgement/readback; rejected Dismiss retains fixed recovery feedback and no provider text. Existing notices and destinations are not removed.",
+ "Four immutable-parent browser controls reproduce late success/error toasts over the replacement view and extra health readbacks after accepted mutations. Final twelve captures were opened and inspected; no page error, unexpected endpoint, off-origin request or horizontal overflow was observed.",
+ "This is mounted-view lifetime acceptance, not full-shell/in-place organisation replacement, real queue/provider delivery, native use, publication or release acceptance. An already-issued action is neither cancelled nor undone on unmount."
+ ],
+ "interactions": [
+ "Desktop keyboard Enter and phone touch start the actual queue controls. Existing confirmations are accepted; both Retry/Dismiss controls remain disabled while a synthetic response is held.",
+ "A keyed fixture replacement unmounts the actual old component and mounts the same existing surface with independent health evidence, without page reload. Held responses then complete through the production API client.",
+ "Read and POST budgets, global toast calls, fixed local feedback, replacement heading/state and viewport width are asserted. No notification is sent; all HTTP is synthetic local evidence. Screenshots fast-forward CSS animation only to inspect settled rendering."
+ ]
+}
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx
index d50ceb33b3..00518bb4e5 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx
@@ -78,6 +78,95 @@ const buildAppriseConfig = (): UIAppriseConfig => ({
});
describe('useAlertDestinationsTabState', () => {
+ describe.each(['retryTerminalFailures', 'dismissTerminalFailures'] as const)(
+ '%s view replacement',
+ (action) => {
+ it.each(['accepted', 'rejected'] as const)(
+ 'does not attribute the retired %s result or refresh to the new Notifications tab',
+ async (outcome) => {
+ const confirm = vi.spyOn(window, 'confirm').mockReturnValue(true);
+ vi.mocked(NotificationsAPI.getWebhooks).mockResolvedValue([]);
+ vi.mocked(NotificationsAPI.getDeliveryLog).mockResolvedValue({ entries: [] } as never);
+ vi.mocked(NotificationsAPI.getHealth).mockResolvedValue({
+ queue: { status: 'degraded', attentionRequired: 2 },
+ } as never);
+ const mountTab = () => {
+ const [appriseConfig, setAppriseConfig] = createSignal(buildAppriseConfig());
+ return renderHook(() =>
+ useAlertDestinationsTabState({
+ appriseConfig,
+ setAppriseConfig,
+ configLoadError: () => null,
+ emailConfig: () => buildEmailConfig(),
+ isLoadingDestinations: () => false,
+ isRetrying: () => false,
+ onRetryLoad: vi.fn(),
+ }),
+ );
+ };
+ const retired = mountTab();
+ let current: ReturnType<typeof mountTab> | undefined;
+ try {
+ await waitFor(() => expect(retired.result.deliveryNeedsAttention()).toBe(true));
+ let accept!: (
+ value: Awaited<ReturnType<(typeof NotificationsAPI)[typeof action]>>,
+ ) => void;
+ let reject!: (error: Error) => void;
+ vi.mocked(NotificationsAPI[action]).mockReturnValueOnce(
+ new Promise((yes, no) => {
+ accept = yes;
+ reject = no;
+ }),
+ );
+ const pending = retired.result[action]();
+ retired.cleanup();
+ current = mountTab();
+ await waitFor(() => expect(current!.result.deliveryNeedsAttention()).toBe(true));
+ if (outcome === 'accepted') accept({ success: true, affected: 2 });
+ else reject(new Error('retired action failed'));
+ await pending;
+ expect(NotificationsAPI[action]).toHaveBeenCalledOnce();
+ expect(NotificationsAPI.getHealth).toHaveBeenCalledTimes(2);
+ expect(NotificationsAPI.getDeliveryLog).toHaveBeenCalledTimes(2);
+ expect(AlertsAPI.getEvents).toHaveBeenCalledTimes(2);
+ expect(notificationStore.success).not.toHaveBeenCalled();
+ expect(notificationStore.error).not.toHaveBeenCalled();
+ expect(current.result.queueActionFeedback()).toBeNull();
+ expect(current.result.deliveryNeedsAttention()).toBe(true);
+ expect(current.result.retryingTerminalFailures()).toBe(false);
+ expect(current.result.dismissingTerminalFailures()).toBe(false);
+ await retired.result[action]();
+ await retired.result.loadDeliveryHealth();
+ expect(confirm).toHaveBeenCalledOnce();
+ expect(NotificationsAPI[action]).toHaveBeenCalledOnce();
+ expect(NotificationsAPI.getHealth).toHaveBeenCalledTimes(2);
+
+ // The replacement owns its own deliberate action and readback.
+ vi.mocked(NotificationsAPI[action]).mockResolvedValueOnce({
+ success: true,
+ affected: 2,
+ });
+ vi.mocked(NotificationsAPI.getHealth).mockResolvedValueOnce({
+ queue: { status: 'healthy', attentionRequired: 0 },
+ } as never);
+ await current.result[action]();
+ expect(notificationStore.success).toHaveBeenCalledOnce();
+ expect(notificationStore.error).not.toHaveBeenCalled();
+ expect(NotificationsAPI[action]).toHaveBeenCalledTimes(2);
+ expect(NotificationsAPI.getHealth).toHaveBeenCalledTimes(3);
+ expect(NotificationsAPI.getDeliveryLog).toHaveBeenCalledTimes(3);
+ expect(AlertsAPI.getEvents).toHaveBeenCalledTimes(3);
+ expect(current.result.deliveryNeedsAttention()).toBe(false);
+ } finally {
+ retired.cleanup();
+ current?.cleanup();
+ confirm.mockRestore();
+ }
+ },
+ );
+ },
+ );
+
it('preserves degraded configuration Retry health when the older mount request finishes', async () => {
let finishMount!: (health: Awaited<ReturnType<typeof NotificationsAPI.getHealth>>) => void;
const healthy = { queue: { status: 'healthy', attentionRequired: 0 } } as Awaited<
diff --git a/frontend-modern/src/features/alerts/__tests__/useNotificationDeliveryHealth.lifecycle.test.tsx b/frontend-modern/src/features/alerts/__tests__/useNotificationDeliveryHealth.lifecycle.test.tsx
new file mode 100644
index 0000000000..7b5781dbf1
--- /dev/null
+++ b/frontend-modern/src/features/alerts/__tests__/useNotificationDeliveryHealth.lifecycle.test.tsx
@@ -0,0 +1,182 @@
+import { createRoot } from 'solid-js';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { NotificationsAPI, type NotificationHealth } from '@/api/notifications';
+import { notificationStore } from '@/stores/notifications';
+import { logger } from '@/utils/logger';
+
+import { useNotificationDeliveryHealth } from '../useNotificationDeliveryHealth';
+
+vi.mock('@/api/notifications', () => ({
+ NotificationsAPI: {
+ getHealth: vi.fn(),
+ dismissTerminalFailures: vi.fn(),
+ retryTerminalFailures: vi.fn(),
+ },
+}));
+vi.mock('@/stores/notifications', () => ({
+ notificationStore: { success: vi.fn(), error: vi.fn() },
+}));
+vi.mock('@/utils/logger', () => ({ logger: { error: vi.fn() } }));
+
+const health = { queue: { status: 'degraded', attentionRequired: 2 } } as NotificationHealth;
+const deferred = <T,>() => {
+ let resolve!: (value: T) => void;
+ let reject!: (error: Error) => void;
+ const promise = new Promise<T>((yes, no) => {
+ resolve = yes;
+ reject = no;
+ });
+ return { promise, resolve, reject };
+};
+const mount = (onAfterQueueAction = vi.fn()) => {
+ let dispose!: () => void;
+ const state = createRoot((stop) => {
+ dispose = stop;
+ return useNotificationDeliveryHealth({ onAfterQueueAction });
+ });
+ return { state, dispose, onAfterQueueAction };
+};
+
+describe('notification recovery view lifetime', () => {
+ beforeEach(() => {
+ vi.resetAllMocks();
+ vi.mocked(NotificationsAPI.getHealth).mockResolvedValue(health);
+ });
+
+ it.each(['accepted', 'rejected'] as const)(
+ 'withdraws a retired health read even when it is %s',
+ async (outcome) => {
+ const read = deferred<NotificationHealth>();
+ vi.mocked(NotificationsAPI.getHealth).mockReturnValueOnce(read.promise);
+ const { state, dispose } = mount();
+ const pending = state.loadDeliveryHealth();
+ dispose();
+ if (outcome === 'accepted') read.resolve(health);
+ else read.reject(new Error('retired read failed'));
+ await pending;
+ expect(state.deliveryHealth()).toBeNull();
+ expect(state.deliveryHealthUnavailable()).toBe(false);
+ expect(state.deliveryNeedsAttention()).toBe(false);
+ expect(state.refreshingDeliveryHealth()).toBe(true);
+ expect(logger.error).not.toHaveBeenCalled();
+ await state.loadDeliveryHealth();
+ expect(NotificationsAPI.getHealth).toHaveBeenCalledOnce();
+ },
+ );
+
+ describe.each(['retryTerminalFailures', 'dismissTerminalFailures'] as const)('%s', (action) => {
+ it.each(['accepted', 'rejected'] as const)(
+ 'does not publish a late %s outcome or start follow-up reads after unmount',
+ async (outcome) => {
+ const confirm = vi.spyOn(window, 'confirm').mockReturnValue(true);
+ const write = deferred<Awaited<ReturnType<(typeof NotificationsAPI)[typeof action]>>>();
+ vi.mocked(NotificationsAPI[action]).mockReturnValueOnce(write.promise);
+ const { state, dispose, onAfterQueueAction } = mount();
+ try {
+ await state.loadDeliveryHealth();
+ const pending = state[action]();
+ dispose();
+ if (outcome === 'accepted') write.resolve({ success: true, affected: 2 });
+ else write.reject(new Error('retired action failed'));
+ await pending;
+ expect(NotificationsAPI[action]).toHaveBeenCalledOnce();
+ expect(confirm).toHaveBeenCalledOnce();
+ expect(NotificationsAPI.getHealth).toHaveBeenCalledOnce();
+ expect(onAfterQueueAction).not.toHaveBeenCalled();
+ expect(notificationStore.success).not.toHaveBeenCalled();
+ expect(notificationStore.error).not.toHaveBeenCalled();
+ expect(logger.error).not.toHaveBeenCalled();
+ expect(state.queueActionFeedback()).toBeNull();
+ expect(state.deliveryHealth()).toBe(health);
+ await state[action]();
+ expect(NotificationsAPI[action]).toHaveBeenCalledOnce();
+ expect(confirm).toHaveBeenCalledOnce();
+ } finally {
+ confirm.mockRestore();
+ dispose();
+ }
+ },
+ );
+
+ it('withdraws optional activity work if the view retires before its scheduled callback', async () => {
+ const confirm = vi.spyOn(window, 'confirm').mockReturnValue(true);
+ const { state, dispose, onAfterQueueAction } = mount();
+ try {
+ await state.loadDeliveryHealth();
+ vi.mocked(NotificationsAPI[action]).mockResolvedValueOnce({ success: true, affected: 2 });
+ // Simulate navigation after the accepted mutation, while starting its
+ // health refresh but before the optional activity microtask executes.
+ vi.mocked(NotificationsAPI.getHealth).mockImplementationOnce(async () => {
+ dispose();
+ return { ...health, queue: { ...health.queue, status: 'healthy' } };
+ });
+ await state[action]();
+ expect(notificationStore.success).toHaveBeenCalledOnce();
+ expect(onAfterQueueAction).not.toHaveBeenCalled();
+ expect(state.deliveryHealth()).toBe(health);
+ expect(notificationStore.error).not.toHaveBeenCalled();
+ } finally {
+ confirm.mockRestore();
+ dispose();
+ }
+ });
+
+ it.each(['accepted', 'rejected'] as const)(
+ 'keeps a retired post-action refresh inert when its already-started work is %s',
+ async (outcome) => {
+ const confirm = vi.spyOn(window, 'confirm').mockReturnValue(true);
+ const read = deferred<NotificationHealth>();
+ const activity = deferred<void>();
+ const onAfterQueueAction = vi.fn().mockReturnValue(activity.promise);
+ const { state, dispose } = mount(onAfterQueueAction);
+ try {
+ await state.loadDeliveryHealth();
+ vi.mocked(NotificationsAPI.getHealth).mockReturnValueOnce(read.promise);
+ vi.mocked(NotificationsAPI[action]).mockResolvedValueOnce({ success: true, affected: 2 });
+ const pending = state[action]();
+ await Promise.resolve();
+ await Promise.resolve();
+ expect(onAfterQueueAction).toHaveBeenCalledOnce();
+ expect(notificationStore.success).toHaveBeenCalledOnce();
+ dispose();
+ if (outcome === 'accepted') {
+ activity.resolve();
+ read.resolve({ ...health, queue: { ...health.queue, status: 'healthy' } });
+ } else {
+ activity.reject(new Error('retired activity failed'));
+ read.reject(new Error('retired health failed'));
+ }
+ await pending;
+ expect(state.queueActionFeedback()).toBeNull();
+ expect(state.deliveryHealth()).toBe(health);
+ expect(state.deliveryNeedsAttention()).toBe(true);
+ expect(state.refreshingDeliveryHealth()).toBe(true);
+ expect(notificationStore.error).not.toHaveBeenCalled();
+ expect(logger.error).not.toHaveBeenCalled();
+ } finally {
+ confirm.mockRestore();
+ dispose();
+ }
+ },
+ );
+ });
+
+ it('does not change retained feedback through a retired clear callback', async () => {
+ const confirm = vi.spyOn(window, 'confirm').mockReturnValue(true);
+ const { state, dispose } = mount();
+ try {
+ await state.loadDeliveryHealth();
+ vi.mocked(NotificationsAPI.retryTerminalFailures).mockRejectedValueOnce(new Error('failed'));
+ await state.retryTerminalFailures();
+ const feedback = state.queueActionFeedback();
+ expect(feedback).toMatch(/^Unable to/);
+ dispose();
+ state.clearQueueActionFeedback();
+ expect(state.queueActionFeedback()).toBe(feedback);
+ } finally {
+ confirm.mockRestore();
+ dispose();
+ }
+ });
+});
diff --git a/frontend-modern/src/features/alerts/useNotificationDeliveryHealth.ts b/frontend-modern/src/features/alerts/useNotificationDeliveryHealth.ts
index a98fdb4552..846816253d 100644
--- a/frontend-modern/src/features/alerts/useNotificationDeliveryHealth.ts
+++ b/frontend-modern/src/features/alerts/useNotificationDeliveryHealth.ts
@@ -1,4 +1,4 @@
-import { batch, createMemo, createSignal } from 'solid-js';
+import { batch, createMemo, createSignal, onCleanup } from 'solid-js';
import { NotificationsAPI, type NotificationHealth } from '@/api/notifications';
import { notificationStore } from '@/stores/notifications';
@@ -21,16 +21,24 @@ export function useNotificationDeliveryHealth(options?: {
const [deliveryHealthUnavailable, setDeliveryHealthUnavailable] = createSignal(false);
const [refreshingDeliveryHealth, setRefreshingDeliveryHealth] = createSignal(false);
const [loadedOnce, setLoadedOnce] = createSignal(false);
+ // A request already sent is not cancelled on navigation. Its retired view
+ // must not publish a toast or start follow-up reads in the replacement view.
+ let disposed = false;
+ onCleanup(() => {
+ disposed = true;
+ });
// Mount, configuration retry and queue actions can overlap. Only the latest
// requested snapshot owns health and loading state, regardless of completion order.
let latestHealthRequest = 0;
+ const ownsHealthRequest = (request: number) => !disposed && request === latestHealthRequest;
const loadDeliveryHealth = async () => {
+ if (disposed) return;
const request = ++latestHealthRequest;
setRefreshingDeliveryHealth(true);
try {
const health = await NotificationsAPI.getHealth();
- if (request !== latestHealthRequest) return;
+ if (!ownsHealthRequest(request)) return;
// Snapshot and availability change together. Set one at a time and
// deliveryNeedsAttention reads a half-updated pair (no health, not yet
// unavailable), briefly unmounting the warning and everything it holds.
@@ -39,14 +47,14 @@ export function useNotificationDeliveryHealth(options?: {
setDeliveryHealthUnavailable(health.queue.status === 'unavailable');
});
} catch (error) {
- if (request !== latestHealthRequest) return;
+ if (!ownsHealthRequest(request)) return;
logger.error('Failed to load notification delivery health', error);
batch(() => {
setDeliveryHealth(null);
setDeliveryHealthUnavailable(true);
});
} finally {
- if (request === latestHealthRequest) {
+ if (ownsHealthRequest(request)) {
setLoadedOnce(true);
setRefreshingDeliveryHealth(false);
}
@@ -67,15 +75,18 @@ export function useNotificationDeliveryHealth(options?: {
const [queueActionFeedback, setQueueActionFeedback] = createSignal<string | null>(null);
let latestAction = 0;
const clearQueueActionFeedback = () => {
+ if (disposed) return;
++latestAction;
setQueueActionFeedback(null);
};
const refreshAfterAction = async (action: number) => {
+ if (disposed) return;
await Promise.all([
loadDeliveryHealth(),
Promise.resolve()
- .then(() => options?.onAfterQueueAction?.())
+ .then(() => (disposed ? undefined : options?.onAfterQueueAction?.()))
.catch((error) => {
+ if (disposed) return;
logger.error(
'Failed to refresh notification activity after accepted queue action',
error,
@@ -93,6 +104,7 @@ export function useNotificationDeliveryHealth(options?: {
const [dismissingTerminalFailures, setDismissingTerminalFailures] = createSignal(false);
const retryTerminalFailures = async () => {
+ if (disposed) return;
const count = deliveryHealth()?.queue.attentionRequired ?? 0;
if (count <= 0 || !confirm(getAlertDestinationsDeliveryRetryConfirmation(count))) {
return;
@@ -102,21 +114,24 @@ export function useNotificationDeliveryHealth(options?: {
setRetryingTerminalFailures(true);
try {
const result = await NotificationsAPI.retryTerminalFailures();
+ if (disposed) return;
notificationStore.success(
`${result.affected} retained ${result.affected === 1 ? 'delivery' : 'deliveries'} queued for retry.`,
);
await refreshAfterAction(action);
} catch (error) {
+ if (disposed) return;
logger.error('Failed to retry retained notification deliveries', error);
if (action === latestAction)
setQueueActionFeedback('Unable to retry retained notification deliveries.');
notificationStore.error('Unable to retry retained notification deliveries.');
} finally {
- setRetryingTerminalFailures(false);
+ if (!disposed) setRetryingTerminalFailures(false);
}
};
const dismissTerminalFailures = async () => {
+ if (disposed) return;
const count = deliveryHealth()?.queue.attentionRequired ?? 0;
if (count <= 0 || !confirm(getAlertDestinationsDeliveryDismissConfirmation(count))) {
return;
@@ -126,17 +141,19 @@ export function useNotificationDeliveryHealth(options?: {
setDismissingTerminalFailures(true);
try {
const result = await NotificationsAPI.dismissTerminalFailures();
+ if (disposed) return;
notificationStore.success(
`${result.affected} retained ${result.affected === 1 ? 'failure' : 'failures'} dismissed.`,
);
await refreshAfterAction(action);
} catch (error) {
+ if (disposed) return;
logger.error('Failed to dismiss retained notification failures', error);
if (action === latestAction)
setQueueActionFeedback('Unable to dismiss retained notification failures.');
notificationStore.error('Unable to dismiss retained notification failures.');
} finally {
- setDismissingTerminalFailures(false);
+ if (!disposed) setDismissingTerminalFailures(false);
}
};