Open dmitry-stepanenko opened 1 year ago
Out of curiosity:
We have a large monorepo with multiple applications, that need certain shared features. Each of those features is large and has a lot of translations in it.
Something like this:
shared/
feature1/
translation-scope-1
feature2/
translation-scope-2
feature3/
translation-scope-3
Each app is able to load only those translations it needs. E.g. app1 needs translation-scope-1
and translation-scope-3
, app2 needs only translation-scope-3
and so on. Overall there're like 20 scopes so far.
We've caught this issue when were trying to load few scopes with missing assets mapping in the app config (something like { "input": "libs/common/util-i18n/src/lib/assets", "glob": "**/*", "output": "assets/i18n/common" }
)
I've debugged this a bit and it looks like the problem is caused by this statement https://github.com/ngneat/transloco/blob/941459e385654aaa62dcfd80ba959c12277e73c1/libs/transloco/src/lib/transloco.service.ts#L768-L772
@dmitry-stepanenko I see. You are welcome to open a PR for it 👍 I would also appreciate it if you add a reproduction link and not just an explanation so it is easier to see immediately .
Is there an existing issue for this?
Which Transloco package(s) are the source of the bug?
Transloco
Is this a regression?
Yes
Current behavior
If multiple language scopes could not be loaded simultaneously, the application starts infinite recursive calls.
To reproduce, make the following change in this file
transloco/apps/transloco-playground/src/app/scope-sharing/scope-sharing.module.ts
:This sets 2 scopes that cannot be resolved. If you open http://localhost:4200/scope-sharing after this, you will see infinite recursive http calls
Expected behavior
Should attempt to load the scope once and exit with a failure.
Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.
reproduction steps described above
Transloco Config
No response
Please provide the environment you discovered this bug in
Browser
No response
Additional context
No response
I would like to make a pull request for this bug
No