Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useOverflowContainer): Removes double overflowManager creation #32459

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
ling1726 marked this conversation as resolved.
Show resolved Hide resolved
"type": "patch",
"comment": "fix(useOverflowContainer): Removes double overflowManager creation",
"packageName": "@fluentui/react-overflow",
"email": "lingfangao@hotmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const useOverflowContainer = <TElement extends HTMLElement>(
update: OnUpdateOverflow,
options: Omit<ObserveOptions, 'onUpdateOverflow'>,
): UseOverflowContainerReturn<TElement> => {
'use no memo';

const {
overflowAxis = 'horizontal',
overflowDirection = 'end',
Expand Down Expand Up @@ -74,7 +76,9 @@ export const useOverflowContainer = <TElement extends HTMLElement>(
const newOverflowManager = createOverflowManager();
newOverflowManager.observe(containerRef.current, overflowOptions);
setOverflowManager(newOverflowManager);
}, [overflowOptions, firstMount]);
// We don't want to re-create the overflow manager when the first mount flag changes from true to false
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [overflowOptions]);

/* Clean up overflow manager on unmount */
React.useEffect(
Expand Down
Loading