From cefb5234b6c2c3b6700d56af06b48e70c1a54b66 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:29:34 +0100 Subject: [PATCH] Type fix --- editor.planx.uk/src/components/Toast/Toast.tsx | 6 +++++- editor.planx.uk/src/index.tsx | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) 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";