diff --git a/packages/default-theme/components/SwTopNavigation.vue b/packages/default-theme/components/SwTopNavigation.vue index d79a6c2f1..4832d8923 100644 --- a/packages/default-theme/components/SwTopNavigation.vue +++ b/packages/default-theme/components/SwTopNavigation.vue @@ -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 {