xenial-black
xenial-black17mo ago

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 ?
No description
8 Replies
kapa.ai
kapa.ai17mo ago
Hey @rhengles! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
kapa.ai
kapa.ai17mo ago
---------------------- 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!
kapa.ai
kapa.ai17mo ago
<@246421183484919808> kapa.ai is still learning and improving, please let us how it did by reacting below
xenial-black
xenial-black17mo 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...
fair-rose
fair-rose17mo 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?
xenial-black
xenial-black17mo 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
fair-rose
fair-rose17mo 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?
xenial-black
xenial-black17mo 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 😅 )