Apollo client executing 4 times the same mutation

I’m having a problem with the Apollo client using offline persistence. my mutations are executing on after connection return, but, after connection return the mutation is executing four times to one mutation.

my function using the hook useMutation

Did you confirm that the server request was actually being sent four times, or is it just that the cache.modify modifier function triggered four times? In the latter case, that would probably be because there are four products root queries in the cache, each with different variable permutations. Does your products query use variables?

1 Like

Yes, i confirmed changes on server.

If my connection status changes of disconnected to connected, the request disparing four times.

In that case I assume the sendProduct function will be called four times as well? If so, I would try to find out what piece of code is calling it that often using a debugger. Judging from your screenshot, there doesn’t seem to be anything wrong that should cause this to happen.

1 Like

could this be caused by the server? Because this situation Just happens when the offline persistir is working