Miscellaneous fixes (#24172)
CI / AMD64 Build (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s

* fix frigate+ submission state bleeding onto the next tracked object

* add Korean

* fix tests
This commit is contained in:
Josh Hawkins
2026-09-03 06:44:18 -05:00
committed by GitHub
parent b4d5035b79
commit 287fc42404
6 changed files with 102 additions and 12 deletions
@@ -1240,10 +1240,14 @@ function ObjectDetailsTab({
search?.plus_id ? "submitted" : "reviewing",
);
useEffect(
() => setState(search?.plus_id ? "submitted" : "reviewing"),
[search],
);
// a submission request outlives the object it was made for, so the
// response handler needs to know which object is on screen now
const displayedIdRef = useRef(search?.id);
useEffect(() => {
displayedIdRef.current = search?.id;
setState(search?.plus_id ? "submitted" : "reviewing");
}, [search]);
const onSubmitToPlus = useCallback(
async (falsePositive: boolean) => {
@@ -1251,10 +1255,12 @@ function ObjectDetailsTab({
return;
}
const eventId = search.id;
try {
const resp = falsePositive
? await axios.put(`events/${search.id}/false_positive`)
: await axios.post(`events/${search.id}/plus`, {
? await axios.put(`events/${eventId}/false_positive`)
: await axios.post(`events/${eventId}/plus`, {
include_annotation: 1,
});
@@ -1262,12 +1268,15 @@ function ObjectDetailsTab({
throw new Error();
}
setState("submitted");
if (displayedIdRef.current === eventId) {
setState("submitted");
}
mutate(
(key) => isEventsKey(key),
(currentData: SearchResult[][] | SearchResult[] | undefined) =>
mapSearchResults(currentData, (event) =>
event.id === search.id
event.id === eventId
? { ...event, plus_id: "new_upload" }
: event,
),
@@ -1278,7 +1287,12 @@ function ObjectDetailsTab({
},
);
} catch {
setState("reviewing");
if (displayedIdRef.current === eventId) {
setState("reviewing");
}
// the toast is not object specific, so it is always shown to avoid
// silently dropping a failed submission
toast.error(
t("explore.plus.review.toast.error", { ns: "components/dialog" }),
{ position: "top-center" },