From b3e8d8dccc279f74b8502446dce25d905f60366a Mon Sep 17 00:00:00 2001 From: xiaowei Date: Tue, 10 Aug 2021 13:39:25 +0800 Subject: [PATCH] fix: add an if statement before calling the unmountComponentAtNode --- src/components/contextView/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/contextView/index.tsx b/src/components/contextView/index.tsx index 9cb729ab1..82337c9d5 100644 --- a/src/components/contextView/index.tsx +++ b/src/components/contextView/index.tsx @@ -68,7 +68,10 @@ export function useContextView(props: IContextViewProps = {}): IContextView { const hide = () => { if (contextView) { contextView.style.visibility = 'hidden'; - ReactDOM.unmountComponentAtNode(select('.' + contentClassName)!); + const contentContainer = select('.' + contentClassName); + if (contentContainer) { + ReactDOM.unmountComponentAtNode(contentContainer); + } Emitter.emit(ContextViewEvent.onHide); } };