You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chore(ui): centralize react-query cache updates in per-resource mutation hooks #30634
Add ui/src/app/shared/mutations.ts with per-resource useMutation hooks, next to the queryOptions factories in shared/queries.ts, so each mutation owns its cache update.
Pages migrated to react-query call services.<resource>.<mutation>() and then update the cache themselves with invalidateQueries or setQueryData. That pair is repeated at every call site, and more pages bring more copies. When a call site leaves out the cache update, or doesn't await it, the page keeps showing data from before the change.
Proposal
One hook per resource (useProjectMutations(name), useClusterMutations(), useGpgKeyMutations()), wrapping useMutation, with the cache update in onSuccess.
onSuccess returns the invalidation promise, so mutateAsync resolves after active queries have refetched.
Error handling stays at the call site, keeping the existing per-action notifications.
Use isPending instead of hand-rolled "updating" state.
Move the pages already migrated (project details, clusters list/details, GnuPG keys) onto the hooks. Later migrations, starting with repositories and certificates, use them from the start.
Activity