Skip to content

Commit

Permalink
fix(surround): remove all posible dupplicate paths
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Dec 3, 2024
1 parent 59c69bc commit d529996
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/internal/surround.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export async function generateItemSurround<T extends PageCollectionItemBase>(que
] as ContentNavigationItem[]
}

function flattedData(data: ContentNavigationItem[]) {
export function flattedData(data: ContentNavigationItem[]) {
const flatData = data.flatMap((item) => {
const children: ContentNavigationItem[] = item.children ? flattedData(item.children) : []
if (item.page === false || (children.length && children[0].path === item.path)) {
if (item.page === false || (children.length && children.find(c => c.path === item.path))) {
return children
}

Expand Down

0 comments on commit d529996

Please sign in to comment.