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

bug(CdkOption): CdkListbox/CdkOption - expression changed after checked error | experimental zoneless change detection #29953

Closed
1 task
andgdk opened this issue Oct 31, 2024 · 1 comment · Fixed by #29970
Assignees
Labels
cdk/core P2 The issue is important to a large percentage of users, with a workaround

Comments

@andgdk
Copy link
Contributor

andgdk commented Oct 31, 2024

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I am preparing for zoneless change detection and configured my app with those providers:

provideExperimentalZonelessChangeDetection(),
provideExperimentalCheckNoChangesForDebug({
    interval: 10000,
    exhaustive: true,
    // useNgZoneOnStable: true,
}),

An expression changed after it has been checked error is thron w/ CdkOption_HostBindings (listbox.mjs:165:59) in the stack trace.

Reproduction

StackBlitz reproduction

Run in StackBlitz and open the developer console.

  • As long as the user does not interact w/ any button, the expression has changed after it has been checked error is thrown in each interval.
  • As soon as any button is pressed, the error is not thrown any more.

Expected Behavior

The error not being thrown - given that I did not make a mistake while providing the initial value.

Actual Behavior

ERROR RuntimeError: NG0100: ExpressionChangedAfterItHasBeenCheckedError:
Expression has changed after it was checked. Previous value for 'attr.tabindex': '-1'. Current value: '0'.
Expression location: _SomeOnPushComponent component. Find more at https://angular.dev/errors/NG0100
    at throwErrorIfNoChangesMode (core.mjs:10493:9)
    at bindingUpdated (core.mjs:18604:9)
    at ɵɵattribute (core.mjs:20540:7)
    at CdkOption_HostBindings (listbox.mjs:165:59)
    at processHostBindingOpCodes (core.mjs:11662:9)
    at refreshView (core.mjs:13392:5)
    at detectChangesInView (core.mjs:13552:5)
    at detectChangesInViewIfAttached (core.mjs:13514:3)
    at detectChangesInEmbeddedViews (core.mjs:13474:7)
    at refreshView (core.mjs:13371:5)

Environment

  • Angular: 18.2.9
  • CDK/Material: 18.2.10
  • Browser(s): Edge 128.0.2739.54
  • Operating System: Windows 11
  • Node: 22.10.0
  • OS: win32-x64
  • Native Target: x86_64-windows
  • yarn: 4.5.1
@andgdk andgdk added the needs triage This issue needs to be triaged by the team label Oct 31, 2024
@wagnermaciel wagnermaciel added P2 The issue is important to a large percentage of users, with a workaround cdk/core and removed needs triage This issue needs to be triaged by the team labels Nov 5, 2024
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cdk/core P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants