forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix API page check during SSG page collecting (vercel#17092)
Fixes SSG pages that start with `/api` not being detected as SSG pages. This also adds tests to ensure this is working correctly in the `prerender` suite. x-ref: vercel#17091
- Loading branch information
Showing
3 changed files
with
90 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useRouter } from 'next/router' | ||
|
||
export const getStaticProps = () => { | ||
return { | ||
props: { | ||
hello: 'world', | ||
}, | ||
} | ||
} | ||
|
||
export const getStaticPaths = () => { | ||
return { | ||
paths: ['/api-docs/first'], | ||
fallback: true, | ||
} | ||
} | ||
|
||
export default function Slug(props) { | ||
if (useRouter().isFallback) return 'Loading...' | ||
|
||
return ( | ||
<> | ||
<p id="api-docs">API Docs</p> | ||
<p id="props">{JSON.stringify(props)}</p> | ||
</> | ||
) | ||
} |
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