Skip to content

Commit

Permalink
fix(dialog): fix ssr render
Browse files Browse the repository at this point in the history
  • Loading branch information
HaixingOoO committed Feb 21, 2024
1 parent d89581a commit e9a4c27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dialog/hooks/useDialogPosition.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MutableRefObject, useEffect, useLayoutEffect, useRef } from 'react';
import { MutableRefObject, useEffect, useRef } from 'react';
import useIsomorphicLayoutEffect from '../../_util/useLayoutEffect';

export default function useDialogPosition(visible: boolean, dialogCardRef: MutableRefObject<HTMLElement>) {
const mousePosRef = useRef(null);
Expand All @@ -13,7 +14,7 @@ export default function useDialogPosition(visible: boolean, dialogCardRef: Mutab
}, 100);
};

useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
document.addEventListener('click', getClickPosition, true);
return () => {
document.removeEventListener('click', getClickPosition, true);
Expand Down

0 comments on commit e9a4c27

Please sign in to comment.