Skip to content

Commit 5c0efdc

Browse files
fix: prevent disable buttons hook from running on column resize (#8666)
1 parent ef47aa3 commit 5c0efdc

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

packages/ibm-products/src/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const FilterFlyout = ({
103103
initialValue: true,
104104
filtersState,
105105
prevFiltersRef,
106+
open,
106107
});
107108

108109
// Skip resize testing

packages/ibm-products/src/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ const FilterPanel = ({
117117
initialValue: true,
118118
filtersState,
119119
prevFiltersRef,
120+
open: panelOpen,
120121
});
121122

122123
const shouldReduceMotion = usePrefersReducedMotion();

packages/ibm-products/src/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ const useShouldDisableButtons = ({
2121
initialValue, // initially the buttons should be disabled
2222
filtersState,
2323
prevFiltersRef,
24+
open,
2425
}) => {
2526
const [shouldDisableButtons, setShouldDisableButtons] =
2627
useState(initialValue);
2728

2829
useEffect(
2930
function updateDisabledButtonsState() {
31+
// prevent this effect from running when columns are being resized
32+
if (!open) {
33+
return;
34+
}
3035
setShouldDisableButtons(
3136
deepCompareObject(filtersState, JSON.parse(prevFiltersRef.current))
3237
);

0 commit comments

Comments
 (0)