Update tracked object description optimistically (#14490)

This commit is contained in:
Josh Hawkins 2024-10-21 16:14:57 -05:00 committed by GitHub
parent 90140e7710
commit b1285a16c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -321,6 +321,28 @@ function ObjectDetailsTab({
(key.includes("events") ||
key.includes("events/search") ||
key.includes("events/explore")),
(currentData: SearchResult[][] | undefined) => {
if (!currentData) return currentData;
// optimistic update
return currentData.map((page) =>
page.map((event) =>
event.id === search.id
? {
...event,
data: {
...event.data,
description: desc,
},
}
: event,
),
);
},
{
optimisticData: true,
rollbackOnError: true,
revalidate: false,
},
);
})
.catch(() => {