diff --git a/editor.planx.uk/src/components/Toast/Toast.tsx b/editor.planx.uk/src/components/Toast/Toast.tsx index 2245efd7ec..4b9219293f 100644 --- a/editor.planx.uk/src/components/Toast/Toast.tsx +++ b/editor.planx.uk/src/components/Toast/Toast.tsx @@ -9,7 +9,11 @@ const Toast = ({ message, type = "success", id }: ToastProps) => { const toast = useToast(); const handleCloseToast = () => { - toast.remove(id); + if (toast) { + toast.remove(id); + } else { + console.warn("ToastContext is not provided."); + } }; return ( diff --git a/editor.planx.uk/src/index.tsx b/editor.planx.uk/src/index.tsx index 285e4a1fdb..b2c4b6b3ce 100644 --- a/editor.planx.uk/src/index.tsx +++ b/editor.planx.uk/src/index.tsx @@ -17,6 +17,7 @@ import HelmetProvider from "react-navi-helmet-async"; import { ToastContainer } from "react-toastify"; // init airbrake before everything else +import * as airbrake from "./airbrake"; import DelayedLoadingIndicator from "./components/DelayedLoadingIndicator"; import { client } from "./lib/graphql"; import navigation from "./lib/navigation";