Next.js: Static pre-fetching does not work on new dynamic routes

Created on 10 Jul 2019  路  1Comment  路  Source: vercel/next.js

Bug report

Describe the bug

If we use new dynamic routing with filenames like this pages/profile/[pid].js. Pre-fetching is trying to fetch _next/static/kACFkwO5w4BLysElZwMn1/pages/profile/actual-name.js because the link href looks like this.

To Reproduce

You can simply visit this link and see the network tab to understand it easily https://undefined-ja3gehzjx.now.sh/profilelist

Expected behavior

The pre-fetch should happen on the actual filename which is [pid].js

Screenshots

Not necessary.

System information

  • Version of Next.js: 9.x

Additional context

  • not needed

Most helpful comment

https://github.com/zeit/next.js#routing

Under Dynamic Routes:

component has two relevant props when using Dynamic Routes:

href: the path inside pages directory
as: the path that will be rendered in the browser URL bar

You need to set both. I assume you currently added only href.

>All comments

https://github.com/zeit/next.js#routing

Under Dynamic Routes:

component has two relevant props when using Dynamic Routes:

href: the path inside pages directory
as: the path that will be rendered in the browser URL bar

You need to set both. I assume you currently added only href.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flybayer picture flybayer  路  3Comments

lixiaoyan picture lixiaoyan  路  3Comments

jesselee34 picture jesselee34  路  3Comments

formula349 picture formula349  路  3Comments

YarivGilad picture YarivGilad  路  3Comments