Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pkozlowski-opensource opened this issue May 15, 2024 · 1 comment
Labels
area: core Issues related to the framework runtime core: change detection core: reactivity Work related to fine-grained reactivity in the core framework cross-cutting: signals
Milestone

Comments

@pkozlowski-opensource
Copy link
Member

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

@pkozlowski-opensource pkozlowski-opensource added area: core Issues related to the framework runtime core: change detection core: reactivity Work related to fine-grained reactivity in the core framework cross-cutting: signals labels May 15, 2024
@ngbot ngbot bot added this to the needsTriage milestone May 15, 2024
@pkozlowski-opensource
Copy link
Member Author

This bugs is surfaced due to the implementation choice described in #55311 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the framework runtime core: change detection core: reactivity Work related to fine-grained reactivity in the core framework cross-cutting: signals
Projects
None yet
Development

No branches or pull requests

1 participant