Skip to content

signal updates and markForCheck should always schedule change detection #53844

@atscott

Description

@atscott

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

core

Is this a regression?

No

Description

Updating a signal or calling markForCheck should schedule change detection. Bound listener callbacks as well as creating, inserting, or attaching a view should also schedule change detection. This will be the case for zoneless applications but should also apply to zone-based applications when these actions happen outside the Angular zone. It is a confusing implementation detail that these APIs do not schedule change detection even though they specifically indicate that change detection should run.

This would address a lot of confusion including, but almost certainly not limited to, my quick search finding the following issues:

along with the ones linked from there: #15770, #15946, #18254, #19731, #20112, #22472, #23697, #24727, #47236 (navigations create views so it should always schedule change detection, even if triggered outside the zone)

In addition to the above, there's plenty of code around that is forced to try dealing with zones when it really shouldn't be necessary because one of the above APIs are used.

There is certainly a question of whether this would make things more unpredictable. For example, would this cause components created outside the zone to act even more unpredictably where some things cause change detection and others don't (because they were created outside the zone).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimearea: zonesIssues related to zone.jscanonicalThis issue represents a canonical design issue in Angular.core: change detection

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions