React 组件更新热重载/刷新导致错误 - 更新代码时 removeChild & insertBefore 错误

问题描述

我已经几个月没有更新我的代码了。刚刚克隆它并安装了软件包。

现在,当我更改代码并且热重载/刷新尝试更新我的 DOM 时出现此错误。

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

当我更新时:

<ul className={props.annotations.drawingEnabled ? 'absolute active' : 'absolute active'}>
    <li>
        <i className="far fa-undo" /> undo
    </li>
</ul>

到:

<ul className={props.annotations.drawingEnabled ? 'absolute active' : 'absolute active'}>
    <li>
        something_new_at_this_place <i className="far fa-undo" /> undo
    </li>
</ul>

这也发生在 SimpleBar https://github.com/Grsmto/simplebar/issues/548

我以前从来没有遇到过这些问题,现在我真的很困惑。 还尝试了较旧的 Node 版本并测试了较旧的提交。出现在 Firefox 和 Chrome 中。

FAST_REFRESH=false @ .env 有效,但整个站点在代码更新时重新加载。

删除这两个导入解决了问题:

import '@mygit/fontawesome-pro/js/all.js';
import 'simplebar';

但为什么它以前有效?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...