Handle case when user switches to element missing the previously selected tab

This commit is contained in:
Nicolas Mowen 2024-09-12 08:16:41 -06:00
parent 425323e6c8
commit a09cc787fb
2 changed files with 9 additions and 2 deletions

View File

@ -35,7 +35,6 @@ import { cn } from "@/lib/utils";
import ActivityIndicator from "@/components/indicators/activity-indicator"; import ActivityIndicator from "@/components/indicators/activity-indicator";
import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record"; import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record";
import { FaImage, FaRegListAlt, FaVideo } from "react-icons/fa"; import { FaImage, FaRegListAlt, FaVideo } from "react-icons/fa";
import FrigatePlusIcon from "@/components/icons/FrigatePlusIcon";
import { FaRotate } from "react-icons/fa6"; import { FaRotate } from "react-icons/fa6";
import ObjectLifecycle from "./ObjectLifecycle"; import ObjectLifecycle from "./ObjectLifecycle";
@ -87,6 +86,14 @@ export default function SearchDetailDialog({
return views; return views;
}, [config, search]); }, [config, search]);
useEffect(() => {
if (!searchTabs.includes(page)) {
setPage("details");
}
// we know that these deps are correct
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchTabs]);
if (!search) { if (!search) {
return; return;
} }

View File

@ -79,7 +79,7 @@ export function FrigatePlusDialog({
const content = ( const content = (
<TransformWrapper minScale={1.0} wheel={{ smoothStep: 0.005 }}> <TransformWrapper minScale={1.0} wheel={{ smoothStep: 0.005 }}>
<DialogHeader> <DialogHeader className={state == "submitted" ? "sr-only" : ""}>
<DialogTitle>Submit To Frigate+</DialogTitle> <DialogTitle>Submit To Frigate+</DialogTitle>
<DialogDescription> <DialogDescription>
Objects in locations you want to avoid are not false positives. Objects in locations you want to avoid are not false positives.