Skip to content

Commit 96c326e

Browse files
committed
fix: stop loading when input filter change has no effect on grid filters
When Ctrl+E clears all filters, the grid's clearAllFilters() removes quick filters and stops loading. However, the input filter's debounced clear arrives later, triggering startLoading('Filtering...') in componentDidUpdate. Since the filters were already cleared, applyInputFilters() finds no changes, never calls setState, and the model update/stopLoading never fires - leaving the grid stuck. Fix: make applyInputFilters() return whether filters actually changed. If no change occurred, immediately call stopLoading() to cancel the loading state that was optimistically started.
1 parent 2f5f6fa commit 96c326e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/iris-grid/src/IrisGrid.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,13 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
959959
this.clearCrossColumSearch();
960960
}
961961
this.startLoading('Filtering...', { resetRanges: true });
962-
this.applyInputFilters(changedInputFilters, replaceExistingFilters);
962+
const isChanged = this.applyInputFilters(
963+
changedInputFilters,
964+
replaceExistingFilters
965+
);
966+
if (!isChanged) {
967+
this.stopLoading();
968+
}
963969
}
964970

965971
if (isSelectingColumn !== prevProps.isSelectingColumn) {
@@ -1671,11 +1677,12 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
16711677
* and clears any existing quickFilters or advancedFilters on that column
16721678
* @param inputFilters Array of input filters to apply
16731679
* @param replaceExisting If true, new filters will replace the existing ones, instead of merging
1680+
* @returns True if any filters were changed as a result of this operation
16741681
*/
16751682
applyInputFilters(
16761683
inputFilters: InputFilter[],
16771684
replaceExisting = false
1678-
): void {
1685+
): boolean {
16791686
const { model } = this.props;
16801687
const { advancedFilters, quickFilters } = this.state;
16811688
const newAdvancedFilters = replaceExisting
@@ -1704,6 +1711,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
17041711
advancedFilters: newAdvancedFilters,
17051712
});
17061713
}
1714+
return isChanged;
17071715
}
17081716

17091717
/**

0 commit comments

Comments
 (0)