adjusting the ref type for the snackbar provider

This commit is contained in:
csawatzky 2025-03-07 15:02:08 -06:00
parent 2fc25431bd
commit 77f0f778a3

View file

@ -1,7 +1,6 @@
import { Button, Theme } from "@mui/material";
import { makeStyles } from "@mui/styles";
import {
ProviderContext as NotistackProviderContext,
SnackbarAction,
SnackbarProvider as NotistackSnackbarProvider,
useSnackbar as useNotistackSnackbar
@ -95,15 +94,17 @@ function SnackbarHelper(props: PropsWithChildren<Props>) {
export default function SnackbarProvider(props: PropsWithChildren<Props>) {
const { children } = props;
const classes = useStyles();
const notistackRef = React.createRef<NotistackProviderContext>();
const providerRef = React.createRef<NotistackSnackbarProvider>();
const onClickDismiss = (key: React.ReactText) => () => {
if (notistackRef && notistackRef.current) notistackRef.current.closeSnackbar(key);
if (providerRef && providerRef.current) {
providerRef.current.closeSnackbar(key);
}
};
return (
<NotistackSnackbarProvider
// ref={notistackRef}
ref={providerRef}
maxSnack={1}
anchorOrigin={{
vertical: "bottom",