File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
apps/epic-web/src/templates Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,6 @@ function findCurrentAndAdjacentItems(
230
230
item : subsection ,
231
231
parentSlug : section . slug ,
232
232
} )
233
-
234
233
subsection . principles ?. forEach ( ( principle ) => {
235
234
flattenedItems . push ( {
236
235
item : principle ,
@@ -241,18 +240,16 @@ function findCurrentAndAdjacentItems(
241
240
} )
242
241
} )
243
242
244
- // Find current item index based on full path match
243
+ // Find current item index based on exact path match
245
244
const currentIndex = flattenedItems . findIndex (
246
245
( { item, parentSlug, subsectionSlug} ) => {
247
- if ( subsectionSlug ) {
248
- return currentPath . includes (
249
- `/principles/${ parentSlug } /${ subsectionSlug } /${ item . slug } ` ,
250
- )
251
- }
252
- if ( parentSlug ) {
253
- return currentPath . includes ( `/principles/${ parentSlug } /${ item . slug } ` )
254
- }
255
- return currentPath === `/principles/${ item . slug } `
246
+ const expectedPath = subsectionSlug
247
+ ? `/principles/${ parentSlug } /${ subsectionSlug } /${ item . slug } `
248
+ : parentSlug
249
+ ? `/principles/${ parentSlug } /${ item . slug } `
250
+ : `/principles/${ item . slug } `
251
+
252
+ return currentPath === expectedPath
256
253
} ,
257
254
)
258
255
You can’t perform that action at this time.
0 commit comments