vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.02k stars 26.7k forks source link

fallback: 'unstable_blocking' is not encoding dynamic params properly #17582

Closed lfades closed 3 years ago

lfades commented 3 years ago

Bug report

Describe the bug

In the following page called pages/post/[slug].tsx:

import { useRouter } from 'next/router'

export async function getStaticPaths() {
  return {
    paths: [{ params: { slug: '/my-post/' } }],
    fallback: 'unstable_blocking',
  }
}

export async function getStaticProps({ params }: any) {
  console.log('SLUG', params.slug)
  return { props: {} }
}

export default function Page() {
  const router = useRouter()
  return <h1>Hello World {router.query.slug}</h1>
}

The value of slug is my-post on development, and %2Fmy-post%2F on production.

Using fallback: 'unstable_blocking' the page will match /post/my-post on development but it won't on production, and using fallback: false the page will encode the param properly and it will never match /post/my-post.

Expected behavior

The encoded param should be consistent in development and production, and while using different values for fallback

System information

realw5 commented 3 years ago

Confirming I am seeing this issue s well

balazsorban44 commented 2 years ago

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.