Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug(transloco): Missing translation error in lazy-loaded pages on initial load #811

Open
1 task done
ali-memar opened this issue Nov 2, 2024 · 0 comments
Open
1 task done

Comments

@ali-memar
Copy link

ali-memar commented Nov 2, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Which Transloco package(s) are the source of the bug?

Transloco

Is this a regression?

No

Current behavior

I'm experiencing an issue with Transloco in my Angular project. In a lazy-loaded page, after refreshing, a "Missing translation for 'home'" error appears in the console on the initial load. However, when I navigate to another page and then return to the lazy-loaded page, the error no longer appears.

It seems that on the initial load, the translation file doesn’t load in time, causing the page to render before translations are available.

Steps to Reproduce:
1- Open the lazy-loaded page.
2- Refresh the page.
3- Observe the console for the "Missing translation" error.
4- Navigate to a different page.
5- Return to the lazy-loaded page.
6- Notice that the error is no longer present.

Expected behavior

When navigating to a lazy-loaded page, all required translation files should be fully loaded before the page renders, so that no "Missing translation" errors appear in the console. The page should display all translations correctly, even on the initial load after a refresh.

Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.

https://codesandbox.io/p/sandbox/vibrant-water-flm8df?workspaceId=c3977a48-d7c1-411a-83ed-053355f0c600

Transloco Config

No response

Please provide the environment you discovered this bug in

"@jsverse/transloco": "7.4.2"

Browser

No response

Additional context

No response

I would like to make a pull request for this bug

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant