Skip to content

Refresh view in AbstractNgModelComponent.setDisabledState - #26237

Closed
maliming wants to merge 1 commit into
rel-10.7from
maliming/lookup-disabled-state
Closed

maliming wants to merge 1 commit into
rel-10.7from
maliming/lookup-disabled-state

Conversation

@maliming

@maliming maliming commented Oct 6, 2026

Copy link
Copy Markdown
Member

setDisabledState now calls markForCheck(), so OnPush components extending AbstractNgModelComponent refresh when the form control is disabled or enabled.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 05:44
@maliming maliming added this to the 10.7-final milestone Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The localized fix includes regression coverage and has no identified blocking issues; tests were not executed.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes disabled-state rendering for OnPush components extending AbstractNgModelComponent.

Changes:

  • Calls markForCheck() after updating the disabled state.
  • Adds regression coverage for disabling and enabling a form control.
File Description
npm/​ng-packs/​packages/​core/​src/​lib/​tests/​ng-model.component.spec.ts Tests both disabled-state transitions with OnPush.
npm/​ng-packs/​packages/​core/​src/​lib/​abstracts/​ng-model.component.ts Marks the view for checking after disabled-state changes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sumeyyeKurtulus

Copy link
Copy Markdown
Contributor

Hello @maliming

Thank you for your fix.

The support report matches the 10.6.1 bug: an effect only copied [disabled] into disabled, so FormControl.disable() → setDisabledState(true) never reached the template.

This fix here https://github.com/volosoft/volo/pull/22983 closes that gap. Lookups/pickers go through AbstractDisableableNgModelComponent. setDisabledState writes formDisabled, and the template binds isDisabled(), which is disabledInput() || formDisabled(). A form disable updates that signal and the view, with no [disabled] workaround.

This update only adds markForCheck() on the base AbstractNgModelComponent.setDisabledState. These components override that method and never call super, and they no longer bind the plain disabled field, so that core change does not run for them and is not required to resolve this ticket.

For this reason, I am closing this PR.

@maliming
maliming deleted the maliming/lookup-disabled-state branch October 7, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants