question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Link to index page with getServerSideProps and basePath results in full page reload

See original GitHub issue

Bug report

Describe the bug

Using the experimental basePath and linking from any page back to the index page with Link results in a full page reload if the index page uses getServerSideProps. Looking at the network tab in Chrome I see a request to http://localhost:3000/base/_next/data/development.json that 404s. In the production build, the request that 404s looks like this http://localhost:3000/base/_next/data/xpCmLw_g1hPw_3b847mWF.json. I believe there’s a / missing before .json.

To Reproduce

  1. Clone this repo https://github.com/bernardop/next-basepath-repro
  2. Install dependencies and yarn dev
  3. Go to http://localhost:3000/base
  4. Click on “a” or “b”
  5. Click on “Back” link
  6. Index page does a full load and the network tab shows 404 to .json

Expected behavior

Index page should not fully reload.

System information

  • OS: macOS
  • All browsers
  • Version of Next.js: 9.4.5-canary.8
  • Version of Node.js: 14.4.0

Additional context

I believe this was introduced in 9.4.5-canary.8 and I suspect #13876 is the culprit. 9.4.5-canary.7 does not have this error.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ijjkcommented, Jun 22, 2020

Closing as this is resolved on latest canary, please reply with additional details if you are still encountering problems after upgrading

0reactions
balazsorban44commented, Jan 29, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Fetching: getServerSideProps - Next.js
If you export a function called getServerSideProps (Server-Side Rendering) from a page, Next.js will pre-render this page on each request using the data ......
Read more >
Is it possible to prevent getServerSideProps causing a full ...
The full page reload happens because the request to retrieve the JSON data for UserDetails page fails during a client-side transition.
Read more >
Refreshing Server-Side Props - Next.js - Josh W Comeau
js to re-fetch the data, on demand, without doing a hard refresh of the whole page? In this short tutorial, I'll share the...
Read more >
Updating Apollo with Nextjs because of getStaticProps and ...
The example uses getStaticProps in the index.js page, here, but I believe ... with next/link , as a full page refresh will reset...
Read more >
getserversideprops not being called - You.com - You.com
Nextjs assumes it to be a component instead of a page, and getServerSideProps () only work inside pages instead of components. Also, getServerSideProps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found