Skip to content
Open
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
17 changes: 14 additions & 3 deletions packages/react/src/components/Popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
}
}
});
const { refs, floatingStyles, placement, middlewareData } = useFloating(
const { refs, floatingStyles, placement, middlewareData, elements, update } = useFloating(
enableFloatingStyles
? {
placement: align,
Expand Down Expand Up @@ -342,14 +342,25 @@
padding: 16,
}),
autoAlign && hide(),
],
whileElementsMounted: autoUpdate,
]
}
: {}
// When autoAlign is turned off & the `enable-v12-dynamic-floating-styles` feature flag is not
// enabled, floating-ui will not be used
);

useEffect(() => {
if (!enableFloatingStyles) return;
if (open && elements.reference && elements.floating) {
const cleanup = autoUpdate(
elements.reference,
elements.floating,
update,
);
return cleanup;
}
}, [open, elements, update]);

Check warning on line 362 in packages/react/src/components/Popover/index.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'enableFloatingStyles'. Either include it or remove the dependency array

const value = useMemo(() => {
return {
floating,
Expand Down
Loading