From 2af89fc86af4b422aa76ea4972805f54af6d430c Mon Sep 17 00:00:00 2001 From: jxj <33154783+BlindMonkLeeSin@users.noreply.github.com> Date: Thu, 2 Mar 2023 10:54:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E8=A2=AB=E9=87=8D=E5=A4=8D=E7=9B=91=E5=90=AC?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E7=9A=84=E9=97=AE=E9=A2=98=20(#48)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: jixianjing --- src/Nav.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Nav.js b/src/Nav.js index 7b1e4bb..d3635ac 100644 --- a/src/Nav.js +++ b/src/Nav.js @@ -237,16 +237,18 @@ class Nav extends React.PureComponent { } if (content) { if (window.MutationObserver) { - this.observe = new MutationObserver(() => { - if (!this.props.once) { - this.reload(); - } - }); - const config = { - childList: true, - subtree: true - }; - this.observe.observe(content, config); + if (!this.observe) { + this.observe = new MutationObserver(() => { + if (!this.props.once) { + this.reload(); + } + }); + const config = { + childList: true, + subtree: true + }; + this.observe.observe(content, config); + } } else { this.prevInnerHTML = content.innerHTML; }