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
1544443f
Unverified
Commit
1544443f
authored
Nov 15, 2019
by
Joe Haddad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve route param error message
parent
1fa612d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
sorted-routes.ts
packages/next/next-server/lib/router/utils/sorted-routes.ts
+4
-4
No files found.
packages/next/next-server/lib/router/utils/sorted-routes.ts
View file @
1544443f
...
...
@@ -46,7 +46,7 @@ class UrlNode {
// Check if the segment matches `[something]`
if
(
nextSegment
.
startsWith
(
'['
)
&&
nextSegment
.
endsWith
(
']'
))
{
// Strip `[` and `]`, leaving only `something`
const
s
lug
Name
=
nextSegment
.
slice
(
1
,
-
1
)
const
s
egment
Name
=
nextSegment
.
slice
(
1
,
-
1
)
function
handleSlug
(
previousSlug
:
string
|
null
,
nextSlug
:
string
)
{
if
(
previousSlug
!==
null
)
{
...
...
@@ -58,7 +58,7 @@ class UrlNode {
if
(
previousSlug
!==
nextSlug
)
{
// TODO: This error seems to be confusing for users, needs an err.sh link, the description can be based on above comment.
throw
new
Error
(
'You cannot use different slug names for the same dynamic path.'
`You cannot use different slug names for the same dynamic path ('
${
previousSlug
}
' !== '
${
nextSlug
}
').`
)
}
}
...
...
@@ -72,9 +72,9 @@ class UrlNode {
slugNames
.
push
(
nextSlug
)
}
handleSlug
(
this
.
slugName
,
s
lug
Name
)
handleSlug
(
this
.
slugName
,
s
egment
Name
)
// slugName is kept as it can only be one particular slugName
this
.
slugName
=
s
lug
Name
this
.
slugName
=
s
egment
Name
// nextSegment is overwritten to [] so that it can later be sorted specifically
nextSegment
=
'[]'
}
...
...
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