Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix asPath handling for data route revalidation in minimal mode (#36660)
- Loading branch information
Showing
3 changed files
with
90 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/production/required-server-files/pages/fallback-false/[slug].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { useRouter } from 'next/router' | ||
|
||
export default function Page(props) { | ||
const router = useRouter() | ||
|
||
return ( | ||
<> | ||
<p id="page">blog slug</p> | ||
<p id="props">{JSON.stringify(props)}</p> | ||
<p id="query">{JSON.stringify(router.query)}</p> | ||
<p id="pathname">{router.pathname}</p> | ||
<p id="asPath">{router.asPath}</p> | ||
</> | ||
) | ||
} | ||
|
||
export function getStaticProps({ params }) { | ||
console.log({ blogSlug: true, params }) | ||
|
||
return { | ||
props: { | ||
random: Math.random() + Date.now(), | ||
blogSlug: true, | ||
params, | ||
}, | ||
revalidate: 1, | ||
} | ||
} | ||
|
||
export function getStaticPaths() { | ||
return { | ||
paths: ['/fallback-false/first', '/fallback-false/second'], | ||
fallback: false, | ||
} | ||
} |