Skip to content

Commit 2d5119f

Browse files
authored
Reduce dom checks for toolbar (#5386)
1 parent 3b4fb99 commit 2d5119f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

packages/@react-aria/actiongroup/src/useActionGroup.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ export function useActionGroup<T>(props: AriaActionGroupProps<T>, state: ListSta
3535
} = props;
3636

3737
let [isInToolbar, setInToolbar] = useState(false);
38-
// should be safe because re-calling set state with the same value it already has is a no-op
39-
// this will allow us to react should a parent re-render and change its role though
40-
// eslint-disable-next-line react-hooks/exhaustive-deps
4138
useLayoutEffect(() => {
4239
setInToolbar(!!(ref.current && ref.current.parentElement?.closest('[role="toolbar"]')));
43-
});
40+
}, [ref]);
4441

4542
let allKeys = [...state.collection.getKeys()];
4643
if (!allKeys.some(key => !state.disabledKeys.has(key))) {

0 commit comments

Comments
 (0)