Add cache invalidation to all project/round mutations platform-wide
Mutations for create, update, delete, import, filtering finalize, override, and reinstate now properly invalidate related queries so the UI updates without requiring a page refresh. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -125,14 +125,19 @@ function EditProjectContent({ projectId }: { projectId: string }) {
|
||||
})
|
||||
|
||||
// Mutations
|
||||
const utils = trpc.useUtils()
|
||||
const updateProject = trpc.project.update.useMutation({
|
||||
onSuccess: () => {
|
||||
utils.project.get.invalidate({ id: projectId })
|
||||
utils.project.list.invalidate()
|
||||
router.push(`/admin/projects/${projectId}`)
|
||||
},
|
||||
})
|
||||
|
||||
const deleteProject = trpc.project.delete.useMutation({
|
||||
onSuccess: () => {
|
||||
utils.project.list.invalidate()
|
||||
utils.round.get.invalidate()
|
||||
router.push('/admin/projects')
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user