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

路由跳转后立即触发页面的react-router 的history.block #2953

Closed
queentvxq opened this issue May 7, 2024 · 1 comment
Closed

Comments

@queentvxq
Copy link

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:
Copy link

github-actions bot commented May 7, 2024

由于缺乏足够的信息(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 May 7, 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