Skip to content

Comments

fix: DH-21744: Fix Advanced Filters in Pivots#2624

Draft
vbabich wants to merge 2 commits intomainfrom
fix-pivot-advanced-filters
Draft

fix: DH-21744: Fix Advanced Filters in Pivots#2624
vbabich wants to merge 2 commits intomainfrom
fix-pivot-advanced-filters

Conversation

@vbabich
Copy link
Collaborator

@vbabich vbabich commented Feb 20, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

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 advanced-filter rendering to better support pivot/column-by scenarios, including models that expose “special” columns via negative indices.

Changes:

  • Extract advanced-filter button and menu rendering into renderAdvancedFilterButton / renderAdvancedFilterMenu.
  • Update focusFilterBar to use getModelColumn and treat negative column indices as valid when filterable.
  • Render advanced-filter buttons and popper menus for filterable columns at negative indices (when the model exposes them).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4957 to +4963
// Advanced filter buttons for columns at negative indexes
// Models can expose columns at negative indexes (e.g., model.columns[-1])
for (let i = -1; model.columns[i] != null; i -= 1) {
if (!model.isFilterable(i)) {
// eslint-disable-next-line no-continue
continue;
}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The logic for iterating over negative-index columns (for (let i = -1; model.columns[i] != null; i -= 1)) is duplicated for both the filter-bar buttons and the popper menus. Consider extracting a small helper that yields the filterable negative indices (or caches them per-render) to keep the render method easier to maintain and reduce the chance of these paths diverging.

Suggested change
// Advanced filter buttons for columns at negative indexes
// Models can expose columns at negative indexes (e.g., model.columns[-1])
for (let i = -1; model.columns[i] != null; i -= 1) {
if (!model.isFilterable(i)) {
// eslint-disable-next-line no-continue
continue;
}
// Helper for advanced filter buttons for columns at negative indexes.
// Models can expose columns at negative indexes (e.g., model.columns[-1]).
const getFilterableNegativeColumnIndices = (): number[] => {
const indices: number[] = [];
for (let i = -1; model.columns[i] != null; i -= 1) {
if (model.isFilterable(i)) {
indices.push(i);
}
}
return indices;
};
// Advanced filter buttons for columns at negative indexes
for (const i of getFilterableNegativeColumnIndices()) {

Copilot uses AI. Check for mistakes.
Comment on lines +4957 to +4975
// Advanced filter buttons for columns at negative indexes
// Models can expose columns at negative indexes (e.g., model.columns[-1])
for (let i = -1; model.columns[i] != null; i -= 1) {
if (!model.isFilterable(i)) {
// eslint-disable-next-line no-continue
continue;
}
const buttonCoordinates = metricState
? metricCalculator.getAdvancedFilterButtonCoordinates(
i,
metricState,
metrics
)
: null;
if (buttonCoordinates != null) {
filterBar.push(
this.renderAdvancedFilterButton(i, i, buttonCoordinates)
);
}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

This change adds new behavior to render advanced-filter buttons/menus for negative column indices (when models expose columns[-1], etc.), but the existing IrisGrid tests only cover the default behavior where negative indices return null coordinates. It would be good to add a test that stubs a metricCalculator implementation returning coordinates for a negative index and verifies the button/menu render and can be shown/hidden correctly for that negative column.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 46.15385% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.77%. Comparing base (c46fbaf) to head (894927b).

Files with missing lines Patch % Lines
packages/iris-grid/src/IrisGrid.tsx 46.15% 35 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2624      +/-   ##
==========================================
- Coverage   49.78%   49.77%   -0.01%     
==========================================
  Files         774      774              
  Lines       43767    43795      +28     
  Branches    11256    11085     -171     
==========================================
+ Hits        21789    21799      +10     
- Misses      21960    21978      +18     
  Partials       18       18              
Flag Coverage Δ
unit 49.77% <46.15%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@vbabich vbabich changed the title fix: DH-...: Fix Advanced Filters in Pivots fix: DH-21744: Fix Advanced Filters in Pivots Feb 20, 2026
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.

1 participant