From d79a1d0a33bed4893115afbd29f689514d6ae0f2 Mon Sep 17 00:00:00 2001 From: pmakode-akamai Date: Wed, 9 Oct 2024 15:54:34 +0530 Subject: [PATCH 1/2] Fix toasts are not consistently dismissible with the 'x' button --- .../manager/src/components/Snackbar/Snackbar.tsx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/manager/src/components/Snackbar/Snackbar.tsx b/packages/manager/src/components/Snackbar/Snackbar.tsx index 7b571405e13..d111476a7f9 100644 --- a/packages/manager/src/components/Snackbar/Snackbar.tsx +++ b/packages/manager/src/components/Snackbar/Snackbar.tsx @@ -1,5 +1,5 @@ import { styled } from '@mui/material/styles'; -import { MaterialDesignContent } from 'notistack'; +import { MaterialDesignContent, closeSnackbar } from 'notistack'; import { SnackbarProvider } from 'notistack'; import * as React from 'react'; @@ -45,18 +45,11 @@ export const Snackbar = (props: SnackbarProviderProps) => { * This pattern is taken from the Notistack docs: * https://iamhosseindhv.com/notistack/demos#action-for-all-snackbars */ - const notistackRef: React.Ref = React.createRef(); - const onClickDismiss = (key: number | string | undefined) => () => { - if (notistackRef.current) { - notistackRef.current.closeSnackbar(key); - } - }; const { children, ...rest } = props; return ( { success: StyledMaterialDesignContent, warning: StyledMaterialDesignContent, }} - action={(key) => ( + action={(snackbarId) => ( closeSnackbar(snackbarId)} text="Dismiss Notification" /> )} From 7e8b37ffc7db82b114420dfded41d616b2a075b6 Mon Sep 17 00:00:00 2001 From: pmakode-akamai Date: Wed, 9 Oct 2024 16:49:08 +0530 Subject: [PATCH 2/2] Added changeset: Toasts are not consistently dismissible with the 'X' button --- packages/manager/.changeset/pr-11073-fixed-1728472748252.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 packages/manager/.changeset/pr-11073-fixed-1728472748252.md diff --git a/packages/manager/.changeset/pr-11073-fixed-1728472748252.md b/packages/manager/.changeset/pr-11073-fixed-1728472748252.md new file mode 100644 index 00000000000..fef868d7530 --- /dev/null +++ b/packages/manager/.changeset/pr-11073-fixed-1728472748252.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Fixed +--- + +Toasts are not consistently dismissible with the 'X' button ([#11073](https://github.com/linode/manager/pull/11073))