Skip to content

fix: relative navigation from index/pathless routes - #8954

Merged
brophdawg11 merged 5 commits into
devfrom
brophdawg11/pathless-relative-links
Jun 8, 2022
Merged

brophdawg11 merged 5 commits into
devfrom
brophdawg11/pathless-relative-links

Conversation

@brophdawg11

@brophdawg11 brophdawg11 commented Jun 8, 2022 •

Copy link
Copy Markdown
Contributor

Continuation of #8697

Closes #8350

<Route element={<Outlet />}>
<Route
path="page"
element={<Navigate to="../../about" />}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanflorence Quick double check here that this double ../.. would be the expected relative path to the /about route?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<Route path="about" />
<Route path="home" element={<Outlet />}>
  <Route element={<Outlet />}>
    <Route element={<Outlet />}>
      <Route element={<Outlet />}>
        <Route
          path="page"
          element={<Navigate to="../../about" />}
        />

Should ignore all the pathless routes, so essentially we're talking about this:

<Route path="about" />
<Route path="home" element={<Outlet />}>
  <Route
    path="page"
    element={<Navigate to="../../about" />}
  />
  • .. goes up to /home route
  • .. x2 goes up to /
  • about goes to /about

So yeah, that sounds right!

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.

[Bug]: Relative navigation issue while navigating from "index" route: ".." doesn't works, I must use "../.." to go back

3 participants