From 8bc145472a1bc86dc96940d52917924d2f0211ab Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 23 Oct 2024 08:31:48 -0500 Subject: [PATCH] Error message and search reset for explore pane (#14534) --- web/src/pages/Explore.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx index eee9fce9b..8989c7b05 100644 --- a/web/src/pages/Explore.tsx +++ b/web/src/pages/Explore.tsx @@ -18,6 +18,7 @@ import { isMobileOnly } from "react-device-detect"; import { LuCheck, LuExternalLink, LuX } from "react-icons/lu"; import { TbExclamationCircle } from "react-icons/tb"; import { Link } from "react-router-dom"; +import { toast } from "sonner"; import useSWR from "swr"; import useSWRInfinite from "swr/infinite"; @@ -180,6 +181,18 @@ export default function Explore() { revalidateFirstPage: true, revalidateOnFocus: true, revalidateAll: false, + onError: (error) => { + toast.error( + `Error fetching tracked objects: ${error.response.data.message}`, + { + position: "top-center", + }, + ); + if (error.response.status === 404) { + // reset all filters if 404 + setSearchFilter({}); + } + }, }); const searchResults = useMemo(