Error message and search reset for explore pane (#14534)

This commit is contained in:
Josh Hawkins 2024-10-23 08:31:48 -05:00 committed by GitHub
parent 7afc1e9762
commit 8bc145472a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(