Data provider requests in loop when using Vite
I am trying to migrate my Refine with Remix app to Vite. This app is still at the very beginning, it's just a login page and a list.
I managed to integrate the auth and data providers, the login is working, the redirect for unlogged users, etc. But now I'm having a strange behavior with the list.
I copied the code for the List page that was working in the remix app, but here in Vite it is loading exactly 202 times. This was code that I exported from the Inferencer. When I try to load the Inferencer directly for the list, the error is even worse, but I think the generated code is probably easier to debug.
Here is a print of my devtools. I think some of these function names are sus, especially
workLoop
. Why is a loop calling my data provider's getList
function ? How can I find out what is subscribing to what ?8 Replies
Hey @rhengles! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the refine documentation (https://refine.dev/docs) and refine blog (https://refine.dev/blog) for more information and examples on using data providers and other refine features.
----------------------
Overview | refine
What is refine?
Blog | refine
A Docusaurus powered blog!
<@246421183484919808> kapa.ai is still learning and improving, please let us how it did by reacting below
manual-pinkOP•2y ago
Just for completeness, when I use the generated code, the page loads the list 202 times, but it's faster. When I use the
<HeadlessListInferencer />
directly, the page flashes during each load, making it very hard to me to wait and see if the loop eventually stops. And also it is hammering our poor backend server...vicious-gold•2y ago
Hey @rhengles,
First, we recommend using Inferencer only in development mode.
I don't understand exactly why the problem you are having. Can you provide a codesandbox environment so I can help?
manual-pinkOP•2y ago
Thank you, I'll do that. But this is the Dev environment, I just don't have the backend to run locally
Umm I'm almost done creating the sandbox, but now I can't integrate the backend because I don't have it in https, the certificate is not set up yet. I'll see if I can mock the backend...
It appears I'm using the auth provider wrong, I'll fix that and see what I get
vicious-gold•2y ago
I'm glad you found the problem. You can see the our documents to fix your auth provider.
You can start here:
https://refine.dev/docs/tutorial/understanding-authprovider/index/
1. Auth Provider | refine
What is auth provider?
manual-pinkOP•2y ago
Thank you, the part that was giving me an error was because I wasn't using the
useGetIdentity
hook (because I didn't read the docs enough 😅 )