stormy-gold
stormy-gold11mo ago

i18n causes duplicate data fetching

I'm trying refine with this example: https://github.com/refinedev/refine/tree/next/examples/i18n-react I noticed the example has some issues: 1. It requests a non-existent file called "translation.json." According to the i18n configuration, "translation.json" is not supposed to be used. Why was it requested? How can it be fixed? 2. i18n causes duplicate API requests when rendering App.jsx. In the /posts route, the posts API is called twice. What is the best practice to resolve this issue?
GitHub
refine/examples/i18n-react at next · refinedev/refine
Build your React-based CRUD applications, without constraints. 🌟 Star to support our work! - refine/examples/i18n-react at next · refinedev/refine
4 Replies
kapa.ai
kapa.ai11mo ago
Hi @larvata. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The extracts provided do not contain information about the specific issues you're encountering with the "i18n-react" example from the refine GitHub repository. However, I can provide some general guidance based on the information available: 1. The "translation.json" file is typically used to store key-value pairs for different languages in an i18n setup. If it's being requested but doesn't exist, it could be due to a misconfiguration in your i18n setup. You might want to check your i18n configuration and ensure that the correct files are being referenced. 2. As for the duplicate API requests, it's hard to say without more context. It could be due to a variety of reasons, such as multiple components making the same request, or a single component making the request multiple times due to re-renders. You might want to investigate further to identify the cause. For more detailed information, I recommend checking out the refine i18n Provider documentation (https://refine.dev/docs/api-reference/core/providers/i18n-provider/) and the refine blog (https://refine.dev/blog) for more insights on using i18n with refine. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai11mo ago
<@389390650577256448> kapa.ai is still learning and improving, please let us how it did by reacting below
rival-black
rival-black11mo ago
Hey @larvata, I am not sure about your first question but for your second question it is because of React strictmode you can have a look at this FAQ https://refine.dev/docs/faq/#why-are-api-calls-triggering-twice You will find you solution.
FAQ | refine
How can I change the form data before submitting it to the API?
stormy-gold
stormy-gold11mo ago
@dipbazz , thanks for the document link! Please forget about the first question. It was related to an issue with the i18next configuration.