Skip to content

Defer block doesn't chunk components inside forwardRef #52014

@eneajaho

Description

@eneajaho

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

core

Is this a regression?

No

Description

Defer block won't chunk the components that are used with a forwardRef.

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [forwardRef(() => DeferMeCmp)],
  template: `
    <button (click)="show.set(!show())">show</button>
    <div>
      @if (show()) { 
         @defer (on immediate) {
           <defer-me />
         }
      }
    </div>
  `,
})
export class AppComponent {
  show = signal(false);
}


// defer-me.cmp.ts

@Component({
  selector: 'defer-me',
  template: ` <div>Defered!</div> `,
  standalone: true,
})
export class DeferMeCmp {}

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

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

No response

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions