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

fix: load the main navigation elements - watch issue #900

Merged
merged 1 commit into from
Jun 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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