useMutation() runs 3 times
Hello,
I have this weird problem that all my mutations across the app runs 3 times I don't know why.
This is my API in the backend:
And this is how I use them in the client:
I am sure that the call from the client doesn't run 3 times. I checked it with console.log.
I would be grateful if anyone helped. THanks.
7 Replies
Also it's not a problem of the the way I create new row because I tried to console.log() at the start of the mutation function and it turned out it runs 3 times.
Does it succeed 3 times or fail?
RQ has retries
It succeeds 3 times
Have you tried logging the even handler on the UI? Does that trigger multiple times?
That’s what you logged before I assume?
Do 3 network calls go out?
It’s important to figure out where the number 3 begins
But it’s a strange one of the network call is coming back with a 2xx status
I think I found where the problem at. I am using Electron with
electron-trpc
and I guess it's from create createIPCHandler
handler multiple times.Ah that’s a niche case
I have solved it. It was calling
createIPCHandler
multiple times. Thank you very much for your time.