-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
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
When using the mat-selection-list
with objects to use as values for the nested mat-list-option
components, the application freezes and crashes. At first I thought it was a matter of passing a valid function to the compareWith
prop but it turns out this function is never called.
During my investigation I noticed that depending on the ChangeDetectionStrategy
used, we can prevent a browser crash. When set to Default
the browser will crash but using OnPush
will prevent this (probably unrelated but useful for debugging).
When using the exact same setup but passing strings as values for the nested mat-list-options
components, it works as expected and allows for selecting/deselecting options.
I did not find other bugs that report this behavior, however there is another bug that talks about the compareWith
not being called which might be part of the issue.
Reproduction
Steps to reproduce:
The first mat-selection-list
uses strings and works as expected. The second one fails and does nothing. When changing the change detection to Default
it will freeze up your browser.
Expected Behavior
When passing an object as value to the mat-list-option
it should allow for selecting and deselecting the corresponding mat-list-option
and the mat-selection-list
should emit the correct value.
Actual Behavior
When passing an object as value to the mat-list-option
the browser freezes or the mat-selection-list
does not emit anything
Environment
Angular CLI: 13.0.3
Node: 16.13.0
Package Manager: npm 8.1.0
OS: darwin arm64
Angular: 13.0.2
... animations, common, compiler, core, forms
... platform-browser, platform-browser-dynamic
Package Version
@angular-devkit/architect 0.1300.3
@angular-devkit/build-angular 13.0.3
@angular-devkit/core 13.0.3
@angular-devkit/schematics 13.0.3
@angular/cdk 12.2.13
@angular/cli 13.0.3
@angular/material 12.2.13
@schematics/angular 13.0.3
rxjs 7.4.0
typescript 4.4.4