mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-17 08:35:21 +03:00
fix optimistic description update
This commit is contained in:
parent
4234bc5ad9
commit
71a13753fd
@ -321,22 +321,25 @@ function ObjectDetailsTab({
|
|||||||
(key.includes("events") ||
|
(key.includes("events") ||
|
||||||
key.includes("events/search") ||
|
key.includes("events/search") ||
|
||||||
key.includes("events/explore")),
|
key.includes("events/explore")),
|
||||||
(currentData: SearchResult[][] | undefined) => {
|
(currentData: SearchResult[][] | SearchResult[] | undefined) => {
|
||||||
if (!currentData) return currentData;
|
if (!currentData) {
|
||||||
|
return currentData;
|
||||||
|
}
|
||||||
|
|
||||||
// optimistic update
|
// optimistic update
|
||||||
return currentData.map((page) =>
|
const flattenedData = currentData.flat();
|
||||||
page.map((event) =>
|
const updatedData = flattenedData.map((event) =>
|
||||||
event.id === search.id
|
event.id === search.id
|
||||||
? {
|
? {
|
||||||
...event,
|
...event,
|
||||||
data: {
|
data: {
|
||||||
...event.data,
|
...event.data,
|
||||||
description: desc,
|
description: desc,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: event,
|
: event,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
return updatedData;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
optimisticData: true,
|
optimisticData: true,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user