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

使用loadMicroApp卸载子应用时,会把registerMicroApps全局注册的子应用一起卸载 #3031

Open
Jiang-K-J opened this issue Dec 29, 2024 · 1 comment

Comments

@Jiang-K-J
Copy link

Jiang-K-J commented Dec 29, 2024

What happens?

主应用:react构建版本18+
子应用:vite构建
子应用使用registerMicroApps进行了全局注册,也在某一个组件中进行了局部注册,并且当这个组件销毁时会卸载掉loadMicroApp注册的这个子应用

bug:现在我通过路由跳转到这个组件中,这个组件使用loadMicroApp局部注册了上面的vite子应用,现在我再跳转到另一个路由,这个路由是由registerMicroApps进行全局注册的(同一个vite子应用),由于组件跳转时手动调用了卸载方法去卸载loadMicroApp注册的这个子应用,导致新进入的这个组件也被卸载了,虽然这个组件是由registerMicroApps进行注册的。

要点:经过排查发现,是异的原因。loadMicroApp是异步卸载,registerMicroApps加载完毕后loadMicroApp才开始卸载,导致把已经加载的组件也被卸载了。
值得注意的是,只有当vite构建的子应用是会有这个问题,webpack构建的不会有这个问题

http://jiang-12-13.com:12121/ 复现地址

852827cab4cb533549d49715366b815

点完样式隔离或者应用共存,再点击vue3子应用,就会导致vue3子应用加载好的页面被卸载,页面展示空白

  • qiankun Version:2.10.16
  • Platform Version:
  • Browser Version:
Copy link

由于缺乏足够的信息(github、stackblitz、codesandbox等可复现仓库),我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。如果只是单独的技术咨询,可移步 https://qiankun.umijs.org/#-community 交流~

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2024
@github-actions github-actions bot reopened this Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant