T
TanStack2y ago
fascinating-indigo

I want to mutate every time the user interacts with the form. useQuery & useMutation cause rerenders

Hello, this is my code: https://hastebin.com/share/iqecihusab.javascript. I have :
const {data: businessDetails} = useQuery<EntityDTO<BusinessDetailsEntity>>(
'getBusinessDetails',
getBusinessDetails
)
const {data: businessDetails} = useQuery<EntityDTO<BusinessDetailsEntity>>(
'getBusinessDetails',
getBusinessDetails
)
that load the data of the form and
const {mutate} = useMutation(setBusinessDetails, {
// onSuccess: () => queryClient.invalidateQueries('getBusinessDetails'),
onError: error =>
notifications.show(
noti({
message: `Error mutating business details. ERR: ` + error,
isSuccess: false,
}),
),
})
const {mutate} = useMutation(setBusinessDetails, {
// onSuccess: () => queryClient.invalidateQueries('getBusinessDetails'),
onError: error =>
notifications.show(
noti({
message: `Error mutating business details. ERR: ` + error,
isSuccess: false,
}),
),
})
that mutates when the form.values changes. But that is causing me infinite re-renders. How can I solve that please? thanks.
Hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?