From 662eec93be153c74dc3f19a56211e0628c505891 Mon Sep 17 00:00:00 2001 From: jinzelin Date: Thu, 29 Aug 2024 09:19:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=99=90=E5=88=B6provider=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E5=94=AF=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hippy_ui_react/src/provider/Provider.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/hippy_ui_react/src/provider/Provider.tsx b/packages/hippy_ui_react/src/provider/Provider.tsx index 170bd74..207d611 100644 --- a/packages/hippy_ui_react/src/provider/Provider.tsx +++ b/packages/hippy_ui_react/src/provider/Provider.tsx @@ -22,7 +22,8 @@ export default class Provider extends Component }; componentDidMount() { - if (!this.props.noGlobalView) { + if (!this.props.noGlobalView && !Provider.hasListenGlobalView) { + Provider.hasListenGlobalView = true; HRUEvent.on(HRU_EVENT_GLOBAL_VIEW, this.listenGlobalView); ConfigCommon.commonListenBackAdd?.(this.backToCloseGlobalView); } @@ -42,6 +43,11 @@ export default class Provider extends Component HRUEvent.emit(HRU_EVENT_GLOBAL_VIEW, params); } + /** + * 记录已经监听全局节点插入事件 + * */ + static hasListenGlobalView = false; + // state更新不及时,这里用变量来记录最新值 private realTimeGlobalViews: UpdateGlobalViewData = {};