@@ -182,6 +182,7 @@ function createPositionApplyingDoubleDots(
182
182
}
183
183
184
184
function getPath ( command : any ) : any {
185
+ if ( typeof command === 'object' && command . outlets ) return command . outlets [ PRIMARY_OUTLET ] ;
185
186
return `${ command } ` ;
186
187
}
187
188
@@ -201,9 +202,13 @@ function updateSegmentGroup(
201
202
}
202
203
203
204
const m = prefixedWith ( segmentGroup , startIndex , commands ) ;
204
- const slicedCommands = commands . slice ( m . lastIndex ) ;
205
-
206
- if ( m . match && slicedCommands . length === 0 ) {
205
+ const slicedCommands = commands . slice ( m . commandIndex ) ;
206
+ if ( m . match && m . pathIndex < segmentGroup . segments . length ) {
207
+ var g = new UrlSegmentGroup ( segmentGroup . segments . slice ( 0 , m . pathIndex ) , { } ) ;
208
+ g . children [ PRIMARY_OUTLET ] =
209
+ new UrlSegmentGroup ( segmentGroup . segments . slice ( m . pathIndex ) , segmentGroup . children ) ;
210
+ return updateSegmentGroupChildren ( g , 0 , slicedCommands ) ;
211
+ } else if ( m . match && slicedCommands . length === 0 ) {
207
212
return new UrlSegmentGroup ( segmentGroup . segments , { } ) ;
208
213
} else if ( m . match && ! segmentGroup . hasChildren ( ) ) {
209
214
return createNewSegmentGroup ( segmentGroup , startIndex , commands ) ;
@@ -241,14 +246,16 @@ function prefixedWith(segmentGroup: UrlSegmentGroup, startIndex: number, command
241
246
let currentCommandIndex = 0 ;
242
247
let currentPathIndex = startIndex ;
243
248
244
- const noMatch = { match : false , lastIndex : 0 } ;
249
+ const noMatch = { match : false , pathIndex : 0 , commandIndex : 0 } ;
245
250
while ( currentPathIndex < segmentGroup . segments . length ) {
246
251
if ( currentCommandIndex >= commands . length ) return noMatch ;
247
252
const path = segmentGroup . segments [ currentPathIndex ] ;
248
253
const curr = getPath ( commands [ currentCommandIndex ] ) ;
249
254
const next =
250
255
currentCommandIndex < commands . length - 1 ? commands [ currentCommandIndex + 1 ] : null ;
251
256
257
+ if ( currentPathIndex > 0 && curr === undefined ) break ;
258
+
252
259
if ( curr && next && ( typeof next === 'object' ) && next . outlets === undefined ) {
253
260
if ( ! compare ( curr , next , path ) ) return noMatch ;
254
261
currentCommandIndex += 2 ;
@@ -259,7 +266,7 @@ function prefixedWith(segmentGroup: UrlSegmentGroup, startIndex: number, command
259
266
currentPathIndex ++ ;
260
267
}
261
268
262
- return { match : true , lastIndex : currentCommandIndex } ;
269
+ return { match : true , pathIndex : currentPathIndex , commandIndex : currentCommandIndex } ;
263
270
}
264
271
265
272
function createNewSegmentGroup (
0 commit comments