fix object mask default name when created from Explore tracking details

This commit is contained in:
Josh Hawkins 2026-06-01 09:15:24 -05:00
parent bc5fbe5eba
commit 79ffd7d281

View File

@ -53,6 +53,7 @@ export default function MasksAndZonesView({
const { data: config } = useSWR<FrigateConfig>("config"); const { data: config } = useSWR<FrigateConfig>("config");
const [allPolygons, setAllPolygons] = useState<Polygon[]>([]); const [allPolygons, setAllPolygons] = useState<Polygon[]>([]);
const [editingPolygons, setEditingPolygons] = useState<Polygon[]>([]); const [editingPolygons, setEditingPolygons] = useState<Polygon[]>([]);
const [polygonsInitialized, setPolygonsInitialized] = useState(false);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [loadingPolygonIndex, setLoadingPolygonIndex] = useState< const [loadingPolygonIndex, setLoadingPolygonIndex] = useState<
number | undefined number | undefined
@ -609,6 +610,7 @@ export default function MasksAndZonesView({
...globalObjectMasks, ...globalObjectMasks,
...objectMasks, ...objectMasks,
]); ]);
setPolygonsInitialized(true);
// Don't overwrite editingPolygons during editing layout shifts // Don't overwrite editingPolygons during editing layout shifts
// from switching to the edit pane can trigger a resize which // from switching to the edit pane can trigger a resize which
// recalculates scaledWidth/scaledHeight and would discard the // recalculates scaledWidth/scaledHeight and would discard the
@ -676,7 +678,7 @@ export default function MasksAndZonesView({
}, [currentEditingProfile]); }, [currentEditingProfile]);
useSearchEffect("object_mask", (coordinates: string) => { useSearchEffect("object_mask", (coordinates: string) => {
if (!scaledWidth || !scaledHeight || isLoading) { if (!scaledWidth || !scaledHeight || isLoading || !polygonsInitialized) {
return false; return false;
} }
// convert box points string to points array // convert box points string to points array