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

router.refresh() causes 404 with basePath #64584

Closed
MarkusWendorf opened this issue Apr 16, 2024 · 1 comment · Fixed by #64589
Closed

router.refresh() causes 404 with basePath #64584

MarkusWendorf opened this issue Apr 16, 2024 · 1 comment · Fixed by #64589
Labels
bug Issue was opened via the bug report template. locked

Comments

@MarkusWendorf
Copy link

Link to the code that reproduces this issue

https://github.com/MarkusWendorf/rsc-bug

To Reproduce

  1. npm run dev
  2. go to http://localhost:3000/path
  3. press "Refresh" button

Current vs. Expected behavior

After pressing "Refresh" you can see 2 rsc requests:

  • 1 with basePath
  • 1 without basePath (causing a 404)

Expected:

  • 1 request without a 404
Screenshot 2024-04-16 at 22 22 46

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 20.9.0
  npm: 10.1.0
  Yarn: 1.22.19
  pnpm: 8.15.4
Relevant Packages:
  next: 14.2.1 // Latest available version is detected (14.2.1).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

App Router

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local)

Additional context

No response

@MarkusWendorf MarkusWendorf added the bug Issue was opened via the bug report template. label Apr 16, 2024
ztanner added a commit that referenced this issue Apr 17, 2024
`initialCanonicalUrl` differs from the `canonicalUrl` that gets set on
the client, such as when there's a basePath set.

This hoists the `canonicalUrl` construction up so we can re-use it when
adding refetch markers to the tree.

This also renames `pathname` -> `path` since it also includes search
params. I added a test to confirm no extra erroneous fetches happened in
both cases.

Fixes #64584


Closes NEXT-3130
ztanner added a commit that referenced this issue Apr 17, 2024
`initialCanonicalUrl` differs from the `canonicalUrl` that gets set on
the client, such as when there's a basePath set.

This hoists the `canonicalUrl` construction up so we can re-use it when
adding refetch markers to the tree.

This also renames `pathname` -> `path` since it also includes search
params. I added a test to confirm no extra erroneous fetches happened in
both cases.

Fixes #64584


Closes NEXT-3130
Copy link
Contributor

github-actions bot commented May 1, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label May 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant