Skip to content

Commit d1817c3

Browse files
committed
fix: don't try to build a path out of a null list of segments
1 parent 2b3900a commit d1817c3

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

modules/RouteNode.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ export default class RouteNode {
184184
}
185185

186186
buildPathFromSegments(segments, params = {}) {
187+
if (!segments) return null
188+
187189
let searchParams = segments
188190
.filter(s => s.parser.hasQueryParams)
189191
.map(s => s.parser.queryParams);
@@ -194,7 +196,7 @@ export default class RouteNode {
194196
.map(p => p + '=' + params[p])
195197
.join('&')
196198

197-
return segments ? segments.map(segment => segment.parser.build(params, {ignoreSearch: true})).join('') + (searchPart ? '?' + searchPart : '') : null
199+
return segments.map(segment => segment.parser.build(params, {ignoreSearch: true})).join('') + (searchPart ? '?' + searchPart : '')
198200
}
199201

200202
buildPath(routeName, params = {}) {

0 commit comments

Comments
 (0)