Custom Loader Called Multiple Times and Only When Directive Present #858
Unanswered
filiptrivan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Transloco with SSR, and I’ve noticed a couple of behaviors that I’m not sure are expected. I’d appreciate any clarification.
Why is my custom loader triggered multiple times during SSR on the same page and only if there is directive present?
When rendering a single page with SSR, I see multiple
console.log('loaded')
entries from myTranslocoLoader
. Here's a simplified version of the loader:I would expect it to load once per language, but I’m seeing it multiple times just for one SSR render.
Config:
Why does the loader get triggered only when a directive is present in the HTML template?
If I remove the directive from the component templates, the loader doesn’t log anything and I can't get translations via
TranslocoService
. I assume this is due to some lazy loading of translations, but I'd like to confirm if this is how it’s supposed to behave.With just putting this line of code inside
app.component.html
the language gets loaded:Beta Was this translation helpful? Give feedback.
All reactions