Skip to content

Commit

Permalink
feat(navigation utils): handle getParent cases when the category slug…
Browse files Browse the repository at this point in the history
… is not localized
  • Loading branch information
PedroAntunesCosta committed Dec 16, 2024
1 parent 16a6fd9 commit d9ead69
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/navigation-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ export const getParents = (
prev = el + 'children'

const localizedData = flattenedSidebar[`${el}${desiredData}`]
if (!parent || (localizedData && localizedData.includes(parent))) {
const unlocalizedData = flattenedSidebar[`${el}${data}`]
if (
localizedData &&
(!parent || (localizedData && localizedData.includes(parent)))
) {
parentsArray.push(localizedData)
} else if (unlocalizedData) {
parentsArray.push(unlocalizedData)
}
})

Expand Down

0 comments on commit d9ead69

Please sign in to comment.