Skip to content

Commit baf6f08

Browse files
committed
fix: useLayoutEffect를 사용해서 크기 계산하게 수정
1 parent c5d57a9 commit baf6f08

File tree

1 file changed

+2
-2
lines changed
  • apps/frontend/src/components/commons/popover

1 file changed

+2
-2
lines changed

apps/frontend/src/components/commons/popover/Content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState } from "react";
1+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
22
import { usePopover } from "@/hooks/usePopover";
33
import { cn } from "@/lib/utils";
44
import { getPosition } from "@/lib/getPopoverPosition";
@@ -13,7 +13,7 @@ export function Content({ children, className }: ContentProps) {
1313
const contentRef = useRef<HTMLDivElement>(null);
1414
const [position, setPosition] = useState({ top: 0, left: 0 });
1515

16-
useEffect(() => {
16+
useLayoutEffect(() => {
1717
if (open && triggerRef.current && contentRef.current) {
1818
const triggerRect = triggerRef.current.getBoundingClientRect();
1919
const contentRect = contentRef.current.getBoundingClientRect();

0 commit comments

Comments
 (0)