Skip to content

Bug: Redirect needs to be placed in correct order to work #1921

@pdeva

Description

@pdeva

The redirect here will not work

export const routes:ReactRouter.Route = (
  <ReactRouter.Route path="/" component={topNav.TopNavbar}>
     <ReactRouter.Route path="comments" component={cbox.CommentBox}/>
     <ReactRouter.Route path="comments2" component={redditView}/>
     <ReactRouter.Redirect from="/comments" to="/comments2" />
  </ReactRouter.Route>
);

However, if placed above the comments route, it will

export const routes:ReactRouter.Route = (
  <ReactRouter.Route path="/" component={topNav.TopNavbar}>
     <ReactRouter.Redirect from="/comments" to="/comments2" />
     <ReactRouter.Route path="comments" component={cbox.CommentBox}/>
     <ReactRouter.Route path="comments2" component={redditView}/>
  </ReactRouter.Route>
);

This goes against the documentation which says that the redirect can be put anywhere.

Also this means there is no place to put a redirect on the '/`, since there is no higher level element to place it on. This is demonstrated in #1920.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions