Replies: 5 comments 12 replies
-
@sergiodxa (hope you don't mind the mention since this is about remix-i18next |
Beta Was this translation helpful? Give feedback.
-
Little update on this one: I've monkey patched remixes loaders and actions to wait for the required assets in |
Beta Was this translation helpful? Give feedback.
-
Realized that this has a high chance to be solved by the route loader API in react-router@6.4 since they run in the frontend. @mjackson is there already a plan on how to use the new react-router apis within remix and how much of them might be exposed to me as a remix-user (especially regarding "frontend-loaders")? If not what would be a good way to get involved in discussions about this? |
Beta Was this translation helpful? Give feedback.
-
Alternatively I know remix-i18next used to do this in previous versions but it seems like something like loaders also makes sense naturally. Just the shortcomings seem to be
at first I thought that if handle were dynamic, called in the backend, and received the request context, and could somehow merge with whatever other nested routes returned that could work too. But yeah no idea what makes sense architecturally for Remix. Perhaps the blocking links idea could be the way as well. |
Beta Was this translation helpful? Give feedback.
-
@sergiodxa are you aware of any new developments in this? I just tried to update my approach with Loader+Action Context (Middleware) might be an interesting contender but I'm afraid this will be server-side only, too. Hope you're having a great day ☀️ |
Beta Was this translation helpful? Give feedback.
-
I'm currently investigating how to further optimise remix-i18next
Problem: Right now when using lazy loaded translation namespaces there can be a flash of untranslated content on the page.
From what I see that is because we lack an API to declare additional blocking requests for a route.
Currently, following the remix-i18next approach:
or we have to introduce a loading state using
useTranslation().ready
(this might become a little more convenient with suspense, but still not ideal from a "network tab obsessive"™ point of view).I think the most remix-y direction today would be to announce the language files a route requires as links but afaik. there is no way of declaring anything other then stylesheets as blocking and also the links function will have trouble finding the correct language to load since it has no access to the react context or the loader data.
When researching, I stumbled upon the old
block()
API that has been removed with 22b291e - that seems to have been a cool thing to solve this?Also the commit mentions a
useTransitionBlocker
hook that might cover this use-case in the future but it seems as if that has not been implemented right?Are there any other ways to ensure the dependencies are loaded before the route is rendered? Or are there developments in that directions that I have missed?
Thanks 💜
Beta Was this translation helpful? Give feedback.
All reactions