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

[Bug]当router.beforeEach使用了async时,浏览器后退时会出现Target container with #view-main not existed while app1 mounting! #3023

Open
benBenXuChao opened this issue Nov 8, 2024 · 0 comments

Comments

@benBenXuChao
Copy link

benBenXuChao commented Nov 8, 2024

浏览器回退时报错:Uncaught Error: application 'app1' died in status SKIP_BECAUSE_BROKEN: [qiankun]: Target container with #view-main not existed while app1 mounting!

  1. 主应用路由使用beforeEach,并且使用了async

router.beforeEach(async (to, from, next) => {
await new Promise(resolve => {
setTimeout(() => {
resolve()
}, 300);
})
next()
})

最小可复现仓库

https://github.com/EasonMar/qiankun-issue-demo.git

需要对代码进行一个小改动
改动文件路径:packages/main/src/router/index.js
将给router添加一个beforeEach

router.beforeEach(async (to, from, next) => {
await new Promise(resolve => {
setTimeout(() => {
resolve()
}, 300);
})
next()
})
export default router

复现步骤,错误日志以及相关配置

点击子应用路由后,点击浏览器的前进后退按钮

相关环境信息

"vue": "3.2.31",
"qiankun": "2.7.0",

@benBenXuChao benBenXuChao changed the title [Bug]当router.beforeEach使用了async时,回退时会出现Target container with #view-main not existed while app1 mounting! [Bug]当router.beforeEach使用了async时,浏览器后退时会出现Target container with #view-main not existed while app1 mounting! Nov 10, 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