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

feat: add config.disableRedirectHoist #1091

Merged
merged 3 commits into from
Sep 17, 2018
Merged

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented Sep 17, 2018

出于一些原因的考虑,我们在处理路由时把所有 redirect 声明提到路由最前面进行匹配,但这导致了一些问题,所以添加了这个配置项,禁用 redirect 上提。

比如:

  1. Redirect 引发整个页面重绘 ant-design/ant-design-pro#2259
  2. 下面的路由配置,访问 /console 会访问到 /console/overview,因为 redirect 规则往前提了。
routes: [{
      path: '/',
      component: 'Index/App',
      indexRoute: { redirect: '/console' },
      routes: [
        {
          path: '/',
          component: '../components/layout/Default',
          routes: [
            {
              path: '/console',
              component: 'Index/Dashboard',
            },
            {
              path: '/:productName',
              indexRoute: { redirect: '/:productName/overview' },
              routes: [
                {
                  path: '/:productName/overview',
                  component: 'Index/product/Overview'
                },
              ]
            },

          ]
        }
      ],
  }],

@sorrycc sorrycc merged commit 2ca9b72 into master Sep 17, 2018
@sorrycc sorrycc deleted the feat/disableRedirectHoist branch September 17, 2018 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant