You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Component bootstrapping during route extraction is not disabled when using provideAppInitializer() #29131
When you run npm start and open the page, you can see that the console log inside the app component (and route guard) is called without a REQUEST present (indicating the route extraction process).
When you comment out the provideAppInitializer() in the app.config.ts this doesn't happen anymore (as expected).
Activity
fix(@angular/ssr): disable component boostrapping when running route …
fix(@angular/ssr): disable component boostrapping when running route …
fix(@angular/ssr): disable component boostrapping when running route …
fix(@angular/ssr): disable component boostrapping when running route …
stewieoO commentedon Jan 16, 2025
@alan-agius4 First of all thanks for fixing this.
I ran into another case:
If i inject a service in the provideAppInitializer
That service will be constructed during route extraction
Getting the log with request being null.
So the question being, another bug or expected behavior?
alan-agius4 commentedon Jan 16, 2025
Running the application initializers during route extraction is the intended behavior as of now.
You can check if
REQUESTis null inprovideAppInitializerand exit early to prevent unnecessary execution.That said, you’re welcome to submit a feature request if you'd like the ability to disable running all application initializers.
stewieoO commentedon Jan 16, 2025
Got it. Thanks for clarifying.
Yeah, that's what i did as a workaround anyways. Combined with a check that it's on the server. As in the browser
REQUESTis null of course 😆Thanks, might do that.
angular-automatic-lock-bot commentedon Feb 16, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.