From f3a50cbd618bb458fbd51c4a41bb5f661c17e7bb Mon Sep 17 00:00:00 2001 From: Evangelos Skopelitis Date: Thu, 12 Dec 2024 13:21:23 -0500 Subject: [PATCH] frontend: ActionsNotifier: Adjust keys for snackbars This change adds a unique refKey for error states, separate from success states, and creates a unique key for every snackbar. This addresses a regression where failure notifications would not appear in the UI. Fixes: #2655 Signed-off-by: Evangelos Skopelitis change --- frontend/src/components/common/ActionsNotifier.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/common/ActionsNotifier.tsx b/frontend/src/components/common/ActionsNotifier.tsx index 7a2505bdf5..afb258e6b6 100644 --- a/frontend/src/components/common/ActionsNotifier.tsx +++ b/frontend/src/components/common/ActionsNotifier.tsx @@ -51,16 +51,20 @@ function PureActionsNotifier({ dispatch, clusterActions }: PureActionsNotifierPr } const prevKey = snackbarRefs.current[clusterAction.id]; - const uniqueKey = clusterAction.key || clusterAction.id; + const uniqueKey = `${clusterAction.key || clusterAction.id}-${Date.now()}`; if (prevKey && prevKey !== uniqueKey) { closeSnackbar(prevKey); } if (clusterAction.message) { - // Check for completed actions + // Check for success or error states const refKey = - clusterAction.state === 'complete' ? `${clusterAction.id}-complete` : clusterAction.id; + clusterAction.state === 'complete' + ? `${clusterAction.id}-complete` + : clusterAction.state === 'error' + ? `${clusterAction.id}-error` + : clusterAction.id; if (!snackbarRefs.current[refKey]) { snackbarRefs.current[refKey] = uniqueKey;