Skip to content

fix: DH-22976: re-apply the quickFilters prop on change - #2712

Merged
mofojed merged 5 commits into
deephaven:mainfrom
SimonVutov:DH-22976-ui.table-filters-do-not-update-when-changed-programmatically
Aug 12, 2026
Merged

fix: DH-22976: re-apply the quickFilters prop on change#2712
mofojed merged 5 commits into
deephaven:mainfrom
SimonVutov:DH-22976-ui.table-filters-do-not-update-when-changed-programmatically

Conversation

@SimonVutov

Copy link
Copy Markdown
Contributor

Make IrisGrid re-apply the quickFilters prop on change, so the parent can own/control it. Same as with sorts.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.52%. Comparing base (0c7d87c) to head (5e96646).
⚠️ Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
packages/iris-grid/src/IrisGrid.tsx 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2712      +/-   ##
==========================================
+ Coverage   51.10%   51.52%   +0.41%     
==========================================
  Files         793      797       +4     
  Lines       45204    45871     +667     
  Branches    11703    11914     +211     
==========================================
+ Hits        23103    23633     +530     
- Misses      22055    22219     +164     
+ Partials       46       19      -27     
Flag Coverage Δ
unit 51.52% <83.33%> (+0.41%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

This PR updates IrisGrid (in packages/iris-grid) so quickFilters can be treated as a controlled prop: when the parent changes quickFilters, the grid re-applies that value (similar to the existing controlled behavior for sorts).

Changes:

  • Detect quickFilters prop changes in componentDidUpdate and re-apply them to grid state.
  • Add an updateQuickFilters helper to update state + trigger filtering UI/refresh.

Comment thread packages/iris-grid/src/IrisGrid.tsx
Comment on lines +1062 to +1064
if (quickFilters !== prevProps.quickFilters) {
this.updateQuickFilters(quickFilters);
}
Comment thread packages/iris-grid/src/IrisGrid.tsx Outdated
Comment on lines +3025 to +3027
this.setState({
quickFilters: quickFilters != null ? new Map(quickFilters) : new Map(),
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As Copilot mentions, we shouldn't be cloning this map. We should just use the map as is.

Suggested change
this.setState({
quickFilters: quickFilters != null ? new Map(quickFilters) : new Map(),
});
this.setState({
quickFilters: quickFilters ?? EMPTY_MAP,
});

if (sorts !== prevProps.sorts) {
this.updateSorts(sorts);
}
if (quickFilters !== prevProps.quickFilters) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should add some unit tests.
Another thing of note - if we apply input filter changes (checked above), those update the quick filters; if quick filters change as well, then we just replace those changes that were just applied from the input filters. I think that's probably okay, and we're unlikely to get a conflict like that.

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

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

Comment on lines +3023 to +3029
updateQuickFilters(quickFilters: ReadonlyQuickFilterMap | null): void {
this.startLoading('Filtering...', { resetRanges: true });
this.setState({
quickFilters: quickFilters ?? EMPTY_MAP,
});
this.grid?.forceUpdate();
}
@SimonVutov
SimonVutov requested a review from mofojed July 6, 2026 20:40
Comment thread packages/iris-grid/src/IrisGrid.tsx Outdated
Comment on lines +1060 to +1066
if (sorts !== prevProps.sorts && !deepEqualEs6(sorts, prevProps.sorts)) {
this.updateSorts(sorts);
}
if (quickFilters !== prevProps.quickFilters) {
if (
quickFilters !== prevProps.quickFilters &&
!deepEqualEs6(quickFilters, prevProps.quickFilters)
) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We shouldn't need deepEquals checks here - if the object is different, then we should apply those changes.

@SimonVutov
SimonVutov requested a review from mofojed August 10, 2026 16:23
@mofojed
mofojed merged commit 254bb39 into deephaven:main Aug 12, 2026
11 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants