Skip to content

HMR crash when changing from / to ng-template syntactic sugar syntax #63361

@montella1507

Description

@montella1507

Which @angular/* package(s) are the source of the bug?

core, compiler

Is this a regression?

No

Description

As far as i know

<div *directiveXYZ></div>

is just syntactic sugar to

<ng-template directiveXYZ>
  <div></div>
</ng-template>

However, when i do changes between those 2 forms, i am getting HMR error.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

`Component update sent to client(s).
Component update failed: ASSERTION ERROR: Should be run in update mode [Expected=> false == true <=Actual]
Error: ASSERTION ERROR: Should be run in update mode [Expected=> false == true <=Actual]
    at throwError (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-L7WOM2WD.js?v=f65d3ff1:699:9) [angular]
    at assertEqual (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-L7WOM2WD.js?v=f65d3ff1:650:5) [angular]
    at refreshView (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5553:16) [angular]
    at detectChangesInView (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5752:5) [angular]
    at detectChangesInViewIfAttached (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5735:3) [angular]
    at detectChangesInComponent (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5728:3) [angular]
    at detectChangesInChildComponents (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5783:5) [angular]
    at refreshView (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5639:7) [angular]
    at detectChangesInView (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5752:5) [angular]
    at detectChangesInViewIfAttached (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5735:3) [angular]
    at detectChangesInEmbeddedViews (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5705:7) [angular]
    at refreshView (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5605:5) [angular]
    at detectChangesInView (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5752:5) [angular]
    at detectChangesInViewWhileDirty (http://localhost:4200/@fs/Users/user/WebstormProjects/frontend/.angular/cache/20.1.6/portal/vite/deps/chunk-DGYNXV74.js?v=f65d3ff1:5524:5) [angular]
Please consider reporting the error at https://github.com/angular/angular-cli/issues
`

Please provide the environment you discovered this bug in (run ng version)

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

Angular CLI: 20.1.6
Node: 22.12.0
Package Manager: yarn 1.22.22
OS: darwin arm64

Angular: 20.1.6
... animations, build, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, localize
... platform-browser, platform-browser-dynamic, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.2001.6
@angular-devkit/build-angular   20.1.6
@angular-devkit/core            20.1.6
@angular-devkit/schematics      20.1.6
@angular/cdk                    20.1.5
@schematics/angular             20.1.6
ng-packagr                      20.1.0
rxjs                            7.8.1
typescript                      5.8.3
webpack                         5.98.0
zone.js                         0.15.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions