ratty-blush
ratty-blush2y ago

Data fetching many times

Hi everyone! I've got strange behaviour in application, where are too many requests after each click for everything, or after some time, but i do nothing for emitting, maybe you know how to deal with it? maybe i should switch on any strategy in data providers?
No description
15 Replies
other-emerald
other-emerald2y ago
which data provider are u using?
ratty-blush
ratty-blush2y ago
for example getList
No description
ratty-blush
ratty-blush2y ago
in App connection dataProviders looks like this
No description
other-emerald
other-emerald2y ago
I dont think it's related to dataprovider. after you clicking the submit button, the app sends 40 request to API ? did i understand correctly ?
ratty-blush
ratty-blush2y ago
i can record video, i'll show what happening
other-emerald
other-emerald2y ago
it would be great 👊
ratty-blush
ratty-blush2y ago
this behaviour
ratty-blush
ratty-blush2y ago
just clicking around frame
other-emerald
other-emerald2y ago
https://tanstack.com/query/v4/docs/react/guides/window-focus-refetching https://refine.dev/docs/api-reference/core/components/refine-config/#reactquery it seems tanstack query invalidates (refetch again) when you focus on browser. you can disable this behaviour by passing clientConfig options to <Refine> please inform me if this solves the problem btw. you are seeing same request twice. it's probably because of <StrictMode> https://refine.dev/blog/react-strict-mode-in-react-18/ If u temporarily remove <StrictMode> or you can inspect on production build. probably you will not see same request twice
ratty-blush
ratty-blush2y ago
let me try) that two points was my solution 1) remove strict mode 2) remove query options)
other-emerald
other-emerald2y ago
i'm glad that worked 🙏
like-gold
like-gold2y ago
@here I am seeing this problem, I didn't watch the video but a simple load of /{entity}/show/{id} triggers the network request a whoppin' 4 times. Removing <React.StrictMode> reduces it by half, but it's still 2 times. Is this specific bug of strict mode being tracked somewhere ? Is it a bug of React Query ? Hmm, I found this: https://github.com/TanStack/query/issues/3492#issuecomment-1095440683 I didn't have any custom query options, I tried everything I saw here but it had no effect whatsoever. Is Refine using Cancellation ?
GitHub
Infinite Query runs twice on initial load with React 18 · Issue #34...
Describe the bug I&#39;m currently using the latest Beta version of React Query with React 18 and noticed my Infinite Query to fetch the initial page two times. As soon as I switch to the React...
other-emerald
other-emerald2y ago
Hi @rhengles, i did check this example https://refine.dev/docs/examples/form/mantine/useForm/ and couldn't encounter a problem. It only send 1 request. what is your implementation look like ? can you reproduce the problem ? If you i'm happy to debug. btw, This is not a specific bug of strict mode. it's the expected behaviour I strongly recommend not to remove strict mode. It only works on production mode
like-gold
like-gold2y ago
Right, I'll try to publish it, I'm using the appwrite adapter...
other-emerald
other-emerald2y ago
I looked at this example. https://refine.dev/docs/examples/data-provider/appwrite/ it sends 2 request on show but it's for diffrent data. one for category, one for post