Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qiankun子应用内 报错Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node. #49009

Closed
ShallowSummertime opened this issue May 21, 2024 · 2 comments
Labels
🤔 Need Reproduce We cannot reproduce your problem

Comments

@ShallowSummertime
Copy link

Reproduction link

https://baijiahao.baidu.com/builder/rc/edit?type=news

Steps to reproduce

webpack://fe-react/node_modules/qiankun/es/sandbox/patchers/dynamicAppend/common.js@call第129行,第40列
124 var rawDOMAppendOrInsertBefore = opts.rawDOMAppendOrInsertBefore,
125 isInvokedByMicroApp = opts.isInvokedByMicroApp,
126 containerConfigGetter = opts.containerConfigGetter;
127
128 if (!isHijackingTag(element.tagName) || !isInvokedByMicroApp(element)) {
129 return rawDOMAppendOrInsertBefore.call(this, element, refChild);
130 }
131
132 if (element.tagName) {
133 var containerConfig = containerConfigGetter(element);
134 var appName = containerConfig.appName,
webpack://cheetahui/node_modules/rc-util/es/Dom/dynamicCSS.js@第74行,第18列
69 // Ignore style which priority less then new style
70 var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
71 return priority >= nodePriority;
72 });
73 if (existStyle.length) {
74 container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
75 return styleNode;
76 }
77 }
78
79 // Use insertBefore as prepend
webpack://cheetahui/node_modules/rc-util/es/Dom/dynamicCSS.js@injectCSS第145行,第16列
140 if (existNode.innerHTML !== css) {
141 existNode.innerHTML = css;
142 }
143 return existNode;
144 }
145 var newNode = injectCSS(css, option);
146 newNode.setAttribute(getMark(option), key);
147 return newNode;
148}
webpack://cheetahui/node_modules/@ant-design/cssinjs/es/hooks/useStyleRegister.js@styleStr第337行,第30列
332 }));
333 });
334
335 // ==================== Inject Style ====================
336 // Inject style
337 var style = updateCSS(styleStr, styleId, mergedCSSConfig);
338 style[CSS_IN_JS_INSTANCE] = cache.instanceId;
339
340 // Used for useCacheToken to remove on batch when token removed
341 style.setAttribute(ATTR_TOKEN, tokenKey);
342
webpack://cheetahui/node_modules/@ant-design/cssinjs/es/hooks/useGlobalCache.js@onCacheEffect第60行,第58列
55 }
56 var cacheContent = cacheEntity[1];
57
58 // Remove if no need anymore
59 useCompatibleInsertionEffect(function () {
60 onCacheEffect === null || onCacheEffect === void 0 || onCacheEffect(cacheContent);
61 }, function (polyfill) {
62 // It's bad to call build again in effect.
63 // But we have to do this since StrictMode will call effect twice
64 // which will clear cache on the first time.
65 buildCache(function (_ref3) {
webpack://cheetahui/node_modules/@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.js@renderEffect第30行,第4列
25 * will use useInsertionEffect if React version >= 18,
26 * otherwise use useInsertionEffectPolyfill.
27 */
28var useCompatibleInsertionEffect = useInsertionEffect ? function (renderEffect, effect, deps) {
29 return useInsertionEffect(function () {
30 renderEffect();
31 return effect();
32 }, deps);
33} : useInsertionEffectPolyfill;
34export default useCompatibleInsertionEffect;

What is expected?

不报错

What is actually happening?

报错Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.

Environment Info
antd 5.17.2
React react18
System window10
Browser Chrome(119.0.0.0)
@afc163
Copy link
Member

afc163 commented May 21, 2024

你给的网址我没有看到错误。

@afc163 afc163 added 🤔 Need Reproduce We cannot reproduce your problem and removed unconfirmed labels May 21, 2024
Copy link
Contributor

Hello @ShallowSummertime. Please provide a online reproduction by forking codesandbox of antd@5.x or antd@4.x, or provide a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 3 days.

你好 @ShallowSummertime,我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 antd@5.xantd@4.x 的 codesandbox,或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。

什么是最小化重现,为什么这是必需的?

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Need Reproduce We cannot reproduce your problem
Projects
None yet
Development

No branches or pull requests

2 participants