Skip to content

Commit 834cb8e

Browse files
author
winjo
authored
fix: check if element of popover exists when delayed hidden (#2764)
1 parent 638f5d8 commit 834cb8e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/components/src/popover/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ export const Popover: React.FC<{
142142
return;
143143
}
144144
hideContentTimer = setTimeout(() => {
145-
contentEl.current!.style.display = 'none';
146-
contentEl.current!.style.visibility = 'hidden';
145+
// 存在延时隐藏时组件已销毁的情况
146+
if (!contentEl.current) {
147+
return;
148+
}
149+
contentEl.current.style.display = 'none';
150+
contentEl.current.style.visibility = 'hidden';
147151
}, delay);
148152
}
149153

0 commit comments

Comments
 (0)