Skip to content

Commit

Permalink
fix(menu): Added fixes required for Concurrent Rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Nov 27, 2021
1 parent 75663e4 commit 05ec620
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/menu/src/Menu.tsx
Expand Up @@ -210,12 +210,14 @@ export const Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu(

const [cancelled, setCancelled] = useState(false);
const prevVisible = useRef(visible);
if (prevVisible.current !== visible) {
prevVisible.current = visible;
if (cancelled) {
setCancelled(false);
useEffect(() => {
if (prevVisible.current !== visible) {
prevVisible.current = visible;
if (cancelled) {
setCancelled(false);
}
}
}
}, [visible, cancelled]);

const fixedTo = useRef<HTMLElement | null>(null);
useEffect(() => {
Expand Down

0 comments on commit 05ec620

Please sign in to comment.