Skip to content

fix(elements): Trigger additional change detection when method is invoked in elements - #17582

Open
mddragnev wants to merge 4 commits into
22.1.xfrom
mdragnev/elements-method-cd-22.1.x
Open

fix(elements): Trigger additional change detection when method is invoked in elements#17582
mddragnev wants to merge 4 commits into
22.1.xfrom
mdragnev/elements-method-cd-22.1.x

Conversation

@mddragnev

@mddragnev mddragnev commented Sep 8, 2026

Copy link
Copy Markdown
Member

Closes #17581

Description

Needed because of zone.js removal

Motivation / Context

Without zone.js, native browser event listeners do not automatically trigger Angular change detection when component methods are invoked from event callbacks. Because UI state changes may occur across various public methods, change detection is defensively scheduled after every method call to ensure consistent state updates.

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Copilot AI lite review requested due to automatic review settings September 8, 2026 09:51
@mddragnev mddragnev changed the title fix(elements): Trigger additional change detection when method is invoked in elements- #17580 fix(elements): Trigger additional change detection when method is invoked in elements Sep 8, 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.

🟡 Changes recommended

It introduces unconditional scheduler-triggered change detection after every method call (potentially redundant when Zone.js is present) and includes formatting issues likely to fail linting.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR addresses missing Angular change detection in Ignite UI Angular Elements when Zone.js is removed, by scheduling additional change detection after invoking exposed component methods from the custom element layer.

Changes:

  • Added a strategy-level notifyChanges() hook to manually schedule change detection for Angular Elements.
  • Wrapped generated element method proxies to invoke notifyChanges() after calling the underlying component method.
  • Added a unit test covering the “method invocation should trigger change detection” scenario (grid search/clear).
File summaries
File Description
projects/igniteui-angular-elements/src/app/custom-strategy.ts Adds notifyChanges() and adjusts a local variable to const.
projects/igniteui-angular-elements/src/app/create-custom-element.ts Updates method proxying to schedule change detection after method calls.
projects/igniteui-angular-elements/src/app/custom-strategy.spec.ts Adds a unit test validating CD after invoking element methods.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Lite

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

Comment thread projects/igniteui-angular-elements/src/app/create-custom-element.ts
Comment thread projects/igniteui-angular-elements/src/app/custom-strategy.spec.ts
Comment thread projects/igniteui-angular-elements/src/app/custom-strategy.ts
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.

4 participants