Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
fix(default-theme): load the main navigation elements - watch issue (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucmus authored Jun 30, 2020
1 parent e571dec commit 3b1bdda
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/default-theme/components/SwTopNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ export default {
switchOverlay(!!currentCategoryName.value)
}
onMounted(() => {
watch(currentLocale, async () => {
onMounted(async () => {
await watch(currentLocale, async () => {
try {
await fetchNavigationElements(3)
} catch (e) {
console.error("[SwTopNavigation]", e)
}
})
// fixes a watch issue - fetch the elements if watch wasn't fired
if (Array.isArray(navigationElements) && !navigationElements.length) {
fetchNavigationElements(3)
}
})
return {
Expand Down

1 comment on commit 3b1bdda

@vercel
Copy link

@vercel vercel bot commented on 3b1bdda Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.