路由跳转后立即触发页面的react-router 的history.block
queentvxq opened this issue · comments
Rebecca commented
What happens?
使用qiankun后路由跳转会立即触发页面的react-router 的history.block
Mini Showcase Repository(REQUIRED)
因为single-spa的popstate触发机制,导致history.pushState跳转路由时触发popstate,从而触发history.block
function patchedUpdateState(updateState, methodName) {
return function () {
var urlBefore = window.location.href;
var result = updateState.apply(this, arguments);
var urlAfter = window.location.href;
if (!urlRerouteOnly || urlBefore !== urlAfter) {
if (isStarted()) {
// fire an artificial popstate event once single-spa is started,
// so that single-spa applications know about routing that
// occurs in a different application
window.dispatchEvent(createPopStateEvent(window.history.state, methodName));
} else {
// do not fire an artificial popstate event before single-spa is started,
// since no single-spa applications need to know about routing events
// outside of their own router.
reroute([]);
}
}
return result;
};
}
How To Reproduce
Steps to reproduce the behavior: 1. 2.
Expected behavior 1. 2.
Context
- qiankun Version:
- Platform Version:
- Browser Version:
github-actions commented
由于缺乏足够的信息(github、stackblitz、codesandbox等可复现仓库),我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。如果只是单独的技术咨询,可移步 https://qiankun.umijs.org/#-community 交流~