Ant-design-pro: 🐛[BUG]SecurityLayout导致重复跳转登录页面

Created on 22 Nov 2019  ·  8Comments  ·  Source: ant-design/ant-design-pro

🐛 bug 描述

本地开发,在进行登录操作时,有时会循环跳转到登录页面,见截图

📷 复现步骤

输入http://localhost:8000/user/login, 输入用户名密码,点击登录,这时会跳转到SecurityLayout进行是否登录的校验,重复到登录页面的情形见截图。
通过network可以看出,已经完成登录,但是还没有查询currentUser。

🏞 期望结果

跳转到首页

© 版本信息

  • Ant Design Pro 版本: 4.5.16
  • umi 版本:2.9.6
  • 浏览器环境 Chrome 77.0.3865.90
  • 开发环境 win10

🚑 其他信息

image
image

Inactive 🛑 bug

Most helpful comment

if (!isLogin && '/user/login' != window.location.pathname) {
    return <Redirect to={`/user/login?${queryString}`}></Redirect>;
}

All 8 comments

你看下这个应该可以解决,我刚用这个方法解决。
#5348

看描述是因为dispatch 和 组件更新速度不同导致的?

应该是了,我觉得应该把isReady=true的代码放到dispatch的callback里,这样就能避免这个问题了。

看描述是因为dispatch 和 组件更新速度不同导致的?

对的

Same issue i am facing.

@twtyjvkg
Have you found the solution?

if (!isLogin && '/user/login' != window.location.pathname) {
    return <Redirect to={`/user/login?${queryString}`}></Redirect>;
}

@Leskur give a pr?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Yoping picture Yoping  ·  3Comments

skyFi picture skyFi  ·  3Comments

Jerry-goodboy picture Jerry-goodboy  ·  3Comments

yaoleiroyal picture yaoleiroyal  ·  3Comments

zhuanglong picture zhuanglong  ·  3Comments