Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Reactivity: effects won't execute if created in a component that is detached from a change detection tree #55808

Closed
@pkozlowski-opensource

Description

@pkozlowski-opensource

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

core

Is this a regression?

No

Description

Effects won't execute if created in a component that is detached from a change detection tree, example:

export class CDDetatched {
  constructor(cdRef: ChangeDetectorRef) {
    cdRef.detach();
  }

  e = effect(() => console.log('An effect in a detached component'));
}

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-7zd1fv?file=src%2Fmain.tsFmain.ts

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?

Created from #55644

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions