Skip to content

Commit

Permalink
fix(popup): popup useMutationObservable watch #text node problem
Browse files Browse the repository at this point in the history
fix #3090
  • Loading branch information
moecasts committed Sep 9, 2024
1 parent 44e4941 commit 94ab025
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ const Popup = forwardRef<PopupRef, PopupProps>((originalProps, ref) => {

const updateTimeRef = useRef(null);
// 监听 trigger 节点或内容变化动态更新 popup 定位
useMutationObserver(getRefDom(triggerRef), ([mutation]) => {
const isDisplayNone = getCssVarsValue('display', mutation.target as HTMLElement) === 'none';
useMutationObserver(getRefDom(triggerRef), () => {
const isDisplayNone = getCssVarsValue('display', getRefDom(triggerRef)) === 'none';
if (visible && !isDisplayNone) {
clearTimeout(updateTimeRef.current);
updateTimeRef.current = setTimeout(() => popperRef.current?.update?.(), 0);
Expand Down

0 comments on commit 94ab025

Please sign in to comment.