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