fix(frontend): keep entity and message deletes in sync
This commit is contained in:
@@ -37,7 +37,13 @@ export default function EntitiesPage() {
|
||||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: (id: string) => deleteEntity(id),
|
||||
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['entities'] }),
|
||||
onSuccess: (_data, id) => {
|
||||
queryClient.setQueryData(
|
||||
['entities'],
|
||||
(currentEntities: Awaited<ReturnType<typeof getEntities>> | undefined) =>
|
||||
currentEntities?.filter((entity) => entity.id !== id) ?? []
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user