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

refactor(material/core): Update internal state of option to use signals #29698

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

atscott
Copy link
Contributor

@atscott atscott commented Sep 5, 2024

This updates the internal state to use signals, eliminating any ExpressionChanged... issues when developers programatically update disabled or selected state during change detection.

@atscott atscott requested a review from a team as a code owner September 5, 2024 16:37
@atscott atscott requested review from crisbeto and amysorto and removed request for a team September 5, 2024 16:37
@@ -107,10 +108,10 @@ export class MatOption<T = any> implements FocusableOption, AfterViewChecked, On
/** Whether the option is disabled. */
@Input({transform: booleanAttribute})
get disabled(): boolean {
return (this.group && this.group.disabled) || this._disabled;
return (this.group && this.group.disabled) || this._disabled();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we migrate the group as well and turn this into a computed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, that's a good thought. It would either require a "breaking" change to the public API of the group or to add a getter/setter pair there so I can set an internal signal.

This updates the internal state to use signals, eliminating any
ExpressionChanged... issues when developers programatically update
disabled or selected state during change detection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants