We currently do not perform any sort of optimistic update on the user data, which means the only way to reflect the changes by an admin is to refetch all the user data, leading to bad UX more inefficiency.
To solve this in the AdminMutations we should mutate the data object, likely using the onMutate property
like in the snippet below (provided by the docs)
onMutate: async (newTodo) => {
// Cancel any outgoing refetches
// (so they don't overwrite our optimistic update)
await queryClient.cancelQueries({ queryKey: ['todos', newTodo.id] })
// Snapshot the previous value
const previousTodo = queryClient.getQueryData(['todos', newTodo.id])
// Optimistically update to the new value
queryClient.setQueryData(['todos', newTodo.id], newTodo)
// Return a context with the previous and new todo
return { previousTodo, newTodo }
}
Is your feature request related to a problem? Please describe.
https://tanstack.com/query/v4/docs/framework/react/guides/optimistic-updates
We currently do not perform any sort of optimistic update on the user data, which means the only way to reflect the changes by an admin is to refetch all the user data, leading to bad UX more inefficiency.
To solve this in the
AdminMutations
we should mutate the data object, likely using theonMutate
propertylike in the snippet below (provided by the docs)
BEFORE MERGING
git fetch origin master:master
, thengit rebase master
orgit merge master
)