Next.js: Experimental basePath causes a refresh on page navigation

Created on 26 Jul 2020  路  3Comments  路  Source: vercel/next.js

Bug report

Describe the bug

Using the experimental basePath feature causes a refresh while navigating with <Link />

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. git clone [email protected]:lucas-janon/base-path-bug.git
  2. Install the dependencies and run the app
  3. Go to http://localhost:3040/base-path-test/
  4. Click on Navigate to /test-b
  5. Wait for a few seconds (the page should get a refresh)

Expected behavior

I expect the page not to be refreshed since it gets annoying to navigate multiple routes in development

System information

  • OS: macOS
  • Browser: Chrome
  • Version of Next.js: 9.4.4
  • Version of Node.js: 12.18.0
bug

Most helpful comment

Confirmed this works fine on canary. Also, you shouldn't be defining both assetPrefix and basePath. Only basePath is required for your setup.

All 3 comments

This is another repo that has the same issue when running yarn dev.
But in both examples, when running the production build with yarn next build and yarn next start, the refresh after navigating to a page using the Link component is gone.

Both of those reproductions are using Next.js 9.4.4. Please upgrade to the latest canary before trying any experimental features.

Confirmed this works fine on canary. Also, you shouldn't be defining both assetPrefix and basePath. Only basePath is required for your setup.

Was this page helpful?
0 / 5 - 0 ratings