Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
2a084334
Unverified
Commit
2a084334
authored
Feb 19, 2020
by
JJ Kasper
Committed by
GitHub
Feb 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update error message for invalid return value from getStaticPaths (#10580)
parent
0a5cc30e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
utils.ts
packages/next/build/utils.ts
+9
-3
No files found.
packages/next/build/utils.ts
View file @
2a084334
...
@@ -562,9 +562,15 @@ export async function isPageStatic(
...
@@ -562,9 +562,15 @@ export async function isPageStatic(
const
staticPathsResult
=
await
(
mod
.
unstable_getStaticPaths
as
Unstable_getStaticPaths
)()
const
staticPathsResult
=
await
(
mod
.
unstable_getStaticPaths
as
Unstable_getStaticPaths
)()
if
(
!
staticPathsResult
||
typeof
staticPathsResult
!==
'object'
)
{
const
expectedReturnVal
=
`Expected: { paths: [] }`
if
(
!
staticPathsResult
||
typeof
staticPathsResult
!==
'object'
||
Array
.
isArray
(
staticPathsResult
)
)
{
throw
new
Error
(
throw
new
Error
(
`Invalid value returned from unstable_getStaticPaths in
${
page
}
. Received
${
typeof
staticPathsResult
}
Expected: { paths: []
}`
`Invalid value returned from unstable_getStaticPaths in
${
page
}
. Received
${
typeof
staticPathsResult
}
${
expectedReturnVal
}
`
)
)
}
}
...
@@ -576,7 +582,7 @@ export async function isPageStatic(
...
@@ -576,7 +582,7 @@ export async function isPageStatic(
throw
new
Error
(
throw
new
Error
(
`Extra keys returned from unstable_getStaticPaths in
${
page
}
(
${
invalidStaticPathKeys
.
join
(
`Extra keys returned from unstable_getStaticPaths in
${
page
}
(
${
invalidStaticPathKeys
.
join
(
', '
', '
)}
)
The only field allowed currently is \`paths\`
`
)}
)
${
expectedReturnVal
}
`
)
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment