qiankun icon indicating copy to clipboard operation
qiankun copied to clipboard

Set window.event while sandbox destroyed or inactive in account-micro!

Open GreatAuk opened this issue 3 years ago • 7 comments

What happens?

在应用间切换的时候有下面两种 warning react_devtools_backend.js:4049 [qiankun] Set window.event while sandbox destroyed or inactive in account-micro! A clear and concise description of what the bug is.

You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "/account-micro" to begin with "/umi-app1-micro".

Mini Showcase Repository(REQUIRED)

https://github.com/GreatAuk/micro-frontend

Provide a mini GitHub repository which can reproduce the issue.

How To Reproduce

确保本地已安装 leran (yarn global add lerna)

$ lerna bootstrap # 安装依赖

$ lerna run start # 

运行 lerna run start 后访问 http://localhost:8000/dashboard 在应用之间切换

Context

  • qiankun Version:
  • Platform Version: mac os 10.15.7
  • Browser Version: chrome 93.0.4577.82

GreatAuk avatar Sep 16 '21 03:09 GreatAuk

与 https://github.com/umijs/qiankun/issues/1369 重复

gongshun avatar Sep 16 '21 08:09 gongshun

@gongshun 看这个 issue https://github.com/umijs/qiankun/issues/222 是修复了的,不知道为什么现在又能复现了。这个 warning 会有实际的性能影响或产生 bug 吗

GreatAuk avatar Sep 16 '21 08:09 GreatAuk

在子应用,增加publicPath配置,内容是主应用触发时的根路由,试试

yang200258 avatar Sep 22 '21 10:09 yang200258

在子应用,增加publicPath配置,内容是主应用触发时的根路由,试试

image image 无效

GreatAuk avatar Sep 23 '21 02:09 GreatAuk

在子应用,增加publicPath配置,内容是主应用触发时的根路由,试试

image image 无效

时间很久了,我也忘记怎么解决了,再提供下我的方案吧(我的主应用上purehtml,子应用是umi): 1、子应用入口文件处: webpack_public_path = window.INJECTED_PUBLIC_PATH_BY_QIANKUN; window.zwfw_new = { bootstrap: (props) => { // eslint-disable-next-line no-console console.log('子应用初始化', props); return Promise.resolve(props); }, mount: (props) => { // eslint-disable-next-line no-console console.log('子应用挂载', props); return Promise.resolve(props); }, unmount: (props) => { // eslint-disable-next-line no-console console.log('子应用卸载', props); return Promise.resolve(props); }, }; 2、考虑是否主、子应用切换时window中全局变量冲突 在主应用中切换时,先暂存window,切换回来时再恢复

yang200258 avatar Sep 23 '21 02:09 yang200258

我也有同样的问题, 主应用vue+qiankun,子应用umi, 报: Set window.event while sandbox destroyed or inactive in xxx. 请问怎么解决呢

tiger-24 avatar May 18 '22 07:05 tiger-24

哈 ,有人知道为啥报这个警告么?目前是主应用umiqiankun,子应用是vue2.X,试过了,子应用改为hash模式就不会出现,history就会出现

sanfengzhanggif avatar May 24 '22 16:05 sanfengzhanggif