Skip to content

Call markForCheck when filter chip is clicked#16972

Open
mtsvyatkova wants to merge 9 commits into
masterfrom
mtsvyatkova/filter-row-chip-click
Open

Call markForCheck when filter chip is clicked#16972
mtsvyatkova wants to merge 9 commits into
masterfrom
mtsvyatkova/filter-row-chip-click

Conversation

@mtsvyatkova

Copy link
Copy Markdown
Contributor

Closes #16903

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

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

@mtsvyatkova

Copy link
Copy Markdown
Contributor Author

Without prior state restoration, the bug is hard to reproduce because Angular's event binding on the chip click calls markForCheck() on the filter cell component, and the dirty flag propagation reaches the header row (I cannot reproduce it without the setState call).

However, after setState(), setStateInternal calls this.grid.cdr.detectChanges() synchronously (line 558 in state-base.directive.ts, marked with // TODO). This forces a full check of the grid subtree, clearing all OnPush dirty flags. After that, the event binding's markForCheck() starting from the filter cell no longer reliably reaches the header row, and isFilterRowVisible is never re-evaluated (line 112 in grid-header-row.component.html).

@mtsvyatkova mtsvyatkova changed the title Call notifyChanges when filter chip is clicked Call markForCheck when filter chip is clicked Feb 25, 2026
@gedinakova gedinakova requested a review from dkamburov February 25, 2026 14:31
@dkamburov dkamburov requested review from skrustev and removed request for dkamburov March 11, 2026 09:24
@github-actions

Copy link
Copy Markdown

There has been no recent activity and this PR has been marked inactive.

@github-actions github-actions Bot added the status: inactive Used to stale issues and pull requests label Jun 18, 2026
@skrustev skrustev removed the status: inactive Used to stale issues and pull requests label Jun 25, 2026
@skrustev

skrustev commented Jul 7, 2026

Copy link
Copy Markdown
Member

@mtsvyatkova
Hey is this PR still viable since I saw it has been a draft for some time?

@mtsvyatkova

Copy link
Copy Markdown
Contributor Author

I initially left this as a draft so that someone with a better understanding of the grid's change detection could take a look. I now realize that this may have caused some confusion.

I'm marking it as Ready for Review so it can be reviewed and/or discarded if the approach isn't the right one.

@mtsvyatkova mtsvyatkova marked this pull request as ready for review July 9, 2026 13:31
Copilot AI review requested due to automatic review settings July 9, 2026 13:31

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.

Pull request overview

Fixes a change-detection edge case in the grid filtering UI where clicking a filter chip may not render/open the filter row until a subsequent UI event occurs (issue #16903).

Changes:

  • Calls ChangeDetectorRef.markForCheck() at the end of onChipClicked() in the grid filtering cell to ensure OnPush components get checked after the chip interaction.
  • Adds a regression test that reproduces the state-restore + filter-chip click scenario and asserts the filtering row is rendered.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
projects/igniteui-angular/grids/core/src/filtering/base/grid-filtering-cell.component.ts Marks the filtering cell view for check after chip click to ensure the filter row becomes visible/rendered under OnPush.
projects/igniteui-angular/grids/core/src/state.directive.spec.ts Adds a regression spec covering filter state restore + chip click and DOM assertion for the filtering row.

Comment thread projects/igniteui-angular/grids/core/src/state.directive.spec.ts
mtsvyatkova and others added 2 commits July 9, 2026 16:34
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

Grid Filter: change detection issue

4 participants