Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/iris-grid/src/IrisGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,13 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
this.clearGridInputField();
this.clearCrossColumSearch();
}
this.startLoading('Filtering...', { resetRanges: true });
this.applyInputFilters(changedInputFilters, replaceExistingFilters);
const isChanged = this.applyInputFilters(
changedInputFilters,
replaceExistingFilters
);
if (isChanged) {
this.startLoading('Filtering...', { resetRanges: true });
}
}

if (isSelectingColumn !== prevProps.isSelectingColumn) {
Expand Down Expand Up @@ -1617,11 +1622,12 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
* and clears any existing quickFilters or advancedFilters on that column
* @param inputFilters Array of input filters to apply
* @param replaceExisting If true, new filters will replace the existing ones, instead of merging
* @returns True if any filters were changed as a result of this operation
*/
applyInputFilters(
inputFilters: InputFilter[],
replaceExisting = false
): void {
): boolean {
const { model } = this.props;
const { advancedFilters, quickFilters } = this.state;
const newAdvancedFilters = replaceExisting
Expand Down Expand Up @@ -1650,6 +1656,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
advancedFilters: newAdvancedFilters,
});
}
return isChanged;
}

/**
Expand Down
51 changes: 51 additions & 0 deletions tests/table-clear-filter.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { test, expect } from '@playwright/test';
import {
dragComponent,
waitForLoadingDone,
openTable,
gotoPage,
} from './utils';

test('ctrl+e clears input filter without getting stuck in Filtering state', async ({
page,
}) => {
await gotoPage(page, '');

await openTable(page, 'all_types');

await test.step('add input filter', async () => {
await page.getByRole('button', { name: 'Controls' }).click();

const inputFilter = page.getByRole('button', { name: 'Input Filter' });
const target = page.getByText('Command History');
const dropIndicator = page.locator('.lm_dragProxy');
await dragComponent(inputFilter, target, dropIndicator);
});

await test.step('configure input filter for Int column', async () => {
await page.getByRole('combobox').selectOption({ label: 'Int' });
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.getByPlaceholder('Enter value...')).toHaveCount(1);
});

await test.step('set input filter value', async () => {
await page.getByPlaceholder('Enter value...').click();
await page.keyboard.type('>1000');
await expect(page.getByPlaceholder('Enter value...')).toHaveValue('>1000');

await waitForLoadingDone(page);
});

await test.step('clear all filters with Ctrl+E', async () => {
// Click on the grid to ensure it has focus for the keyboard shortcut
await page.locator('.iris-grid .grid-wrapper').click();

await page.keyboard.press('ControlOrMeta+e');

// Wait for any debounced updates to process (input filter debounce is ~400ms total)
await page.waitForTimeout(1000);

// The table should NOT be stuck in a loading/filtering state
await waitForLoadingDone(page);
});
});
Loading