optimistic-gold
optimistic-gold•3y ago

Making duplicate calls in the api

Using the github example (finefoods - mui), the application is making duplicate calls in the api Does anyone have a suggestion on how to solve this problem?
No description
7 Replies
Omer
Omer•3y ago
Hey @pedrosilva8235 👋, Could it be related to react strict mode?
optimistic-gold
optimistic-goldOP•3y ago
if it is about the "mutate" parameter, I tested with all the options, and the same problem occurs
Omer
Omer•3y ago
Can you reproduce the same issue in our Ant design example? https://example.admin.refine.dev
Finefoods Ant Design Admin Panel - refine
Web site created using refine
optimistic-gold
optimistic-goldOP•3y ago
I downloaded the updated code from github and ran it locally, for me it keeps duplicating requests
No description
optimistic-gold
optimistic-goldOP•3y ago
One situation that I noticed was that running the compiled application, the problem does not occur
flat-fuchsia
flat-fuchsia•3y ago
Hi @pedrosilva8235, This situation occurs because of Strict Mode https://reactjs.org/docs/strict-mode.html Strict Mode not running on production build. Because of that compiled application works as expected. If you remove StrictMode component in this file this situtation will not happen again. https://github.com/pankod/refine/blob/next/examples/fineFoods/admin/mui/src/index.tsx
continuing-cyan
continuing-cyan•3y ago
Hey @pedrosilva8235 in addition to @alicanerdurmaz's explanation, you can use React Dev Tools extension on your browser to identify strict mode calls instead of disabling it. I think it's a good way to prevent bugs before happening 🚀