mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-07 22:05:44 +03:00
frigate plus submission fix
still show frigate+ section if snapshot has already been submitted and run optimistic update, local state was being overridden
This commit is contained in:
parent
06e5852743
commit
cf9a4a9407
@ -1078,12 +1078,31 @@ function ObjectDetailsTab({
|
|||||||
});
|
});
|
||||||
|
|
||||||
setState("submitted");
|
setState("submitted");
|
||||||
setSearch({
|
mutate(
|
||||||
...search,
|
(key) =>
|
||||||
plus_id: "new_upload",
|
typeof key === "string" &&
|
||||||
});
|
(key.includes("events") ||
|
||||||
|
key.includes("events/search") ||
|
||||||
|
key.includes("events/explore")),
|
||||||
|
(currentData: SearchResult[][] | SearchResult[] | undefined) => {
|
||||||
|
if (!currentData) return currentData;
|
||||||
|
// optimistic update
|
||||||
|
return currentData
|
||||||
|
.flat()
|
||||||
|
.map((event) =>
|
||||||
|
event.id === search.id
|
||||||
|
? { ...event, plus_id: "new_upload" }
|
||||||
|
: event,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
optimisticData: true,
|
||||||
|
rollbackOnError: true,
|
||||||
|
revalidate: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
[search, setSearch],
|
[search, mutate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const popoverContainerRef = useRef<HTMLDivElement | null>(null);
|
const popoverContainerRef = useRef<HTMLDivElement | null>(null);
|
||||||
@ -1243,7 +1262,6 @@ function ObjectDetailsTab({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{search.data.type === "object" &&
|
{search.data.type === "object" &&
|
||||||
!search.plus_id &&
|
|
||||||
config?.plus?.enabled &&
|
config?.plus?.enabled &&
|
||||||
search.has_snapshot && (
|
search.has_snapshot && (
|
||||||
<div
|
<div
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user