Skip to content

Component bootstrapping during route extraction is not disabled when using provideAppInitializer() #29131

Closed
@stewieoO

Description

@stewieoO

Command

serve, build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

The issue of component bootstrapping was discussed in #29085 and fixed in version 19.0.5 with #29101

This generally works, except when you're using an app initializer.

Minimal Reproduction

I have created a repro repo here.

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).

Exception or Error


Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 19.0.5
Node: 20.11.1
Package Manager: pnpm 9.12.2
OS: win32 x64

Angular: 19.0.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.5 (cli-only)
@angular-devkit/build-angular   19.0.5
@angular-devkit/core            19.0.5 (cli-only)
@angular-devkit/schematics      19.0.5 (cli-only)
@angular/cli                    19.0.5
@angular/ssr                    19.0.5
@schematics/angular             19.0.5 (cli-only)
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions