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

Supplying a rewrite to next/link should resolve correctly without href and as #16974

Closed
ijjk opened this issue Sep 9, 2020 · 1 comment · Fixed by #16975
Closed

Supplying a rewrite to next/link should resolve correctly without href and as #16974

ijjk opened this issue Sep 9, 2020 · 1 comment · Fixed by #16975
Assignees
Milestone

Comments

@ijjk
Copy link
Member

ijjk commented Sep 9, 2020

When supplying only a href with a rewrite we should resolve the correct page automatically without triggering a full navigation, e.g.

<Link href="/my-post/1?another=another">
  <a>Post 1</a>
</Link>

with the page post.js and the rewrite

// next.config.js
module.exports = {
  rewrites() {
    return [
      {
        source: "/my-post/:id",
        destination: "/post"
      }
    ];
  }
};

This was noticed to not being working properly in #16825 (comment) by @nghiepit

@ijjk ijjk self-assigned this Sep 9, 2020
@kodiakhq kodiakhq bot closed this as completed in #16975 Sep 10, 2020
kodiakhq bot pushed a commit that referenced this issue Sep 10, 2020
This makes sure we properly resolve a rewrite when only the `href` value is used. This was causing a full-reload and was missed in the existing test since we weren't making sure a full navigation didn't occur which has been added in this PR. 

Fixes: #16974
@Timer Timer added this to the iteration 9 milestone Sep 10, 2020
HitoriSensei pushed a commit to HitoriSensei/next.js that referenced this issue Sep 26, 2020
This makes sure we properly resolve a rewrite when only the `href` value is used. This was causing a full-reload and was missed in the existing test since we weren't making sure a full navigation didn't occur which has been added in this PR. 

Fixes: vercel#16974
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants