From 202c036e16f97e620b6151b9267b9335439e6734 Mon Sep 17 00:00:00 2001 From: Glyn Gray Date: Thu, 19 Mar 2026 23:46:16 -0700 Subject: [PATCH 1/2] fix(fetchMenu): fallback to $fetch on client after hydration --- src/runtime/composables/useDrupalCe/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/runtime/composables/useDrupalCe/index.ts b/src/runtime/composables/useDrupalCe/index.ts index 8568ff21..483a9c7a 100644 --- a/src/runtime/composables/useDrupalCe/index.ts +++ b/src/runtime/composables/useDrupalCe/index.ts @@ -333,6 +333,20 @@ export const useDrupalCe = () => { useFetchOptions.baseURL = getDrupalBaseUrl() + getCeApiEndpoint(false) } + if (import.meta.client && !nuxtApp.isHydrating) { + const menu = ref(undefined) + const { key: _key, getCachedData: _getCachedData, ...clientFetchOptions } = useFetchOptions + + try { + menu.value = await $ceApi(clientFetchOptions, skipDrupalCeApiProxy)(menuPath.value) + } catch (error: unknown) { + const wrappedError = { value: error } + overrideErrorHandler ? overrideErrorHandler(wrappedError) : menuErrorHandler(wrappedError) + } + + return menu + } + const { data: menu, error } = await useFetch(menuPath, useFetchOptions) if (error.value) { From 0e66bdf8668f6e486bc555be4a319552be96de53 Mon Sep 17 00:00:00 2001 From: Glyn Gray Date: Fri, 20 Mar 2026 00:25:45 -0700 Subject: [PATCH 2/2] fix(fetchMenu): preserve menu proxy baseURL in client fallback --- src/runtime/composables/useDrupalCe/index.ts | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/runtime/composables/useDrupalCe/index.ts b/src/runtime/composables/useDrupalCe/index.ts index 483a9c7a..fd93f60b 100644 --- a/src/runtime/composables/useDrupalCe/index.ts +++ b/src/runtime/composables/useDrupalCe/index.ts @@ -327,19 +327,35 @@ export const useDrupalCe = () => { // Override baseURL specifically for menu endpoints if (config.serverApiProxy && !skipDrupalCeApiProxy) { - useFetchOptions.baseURL = '/api/menu' + useFetchOptions.baseURL = '/api/menu/' } else { - useFetchOptions.baseURL = getDrupalBaseUrl() + getCeApiEndpoint(false) + useFetchOptions.baseURL = `${getDrupalBaseUrl() + getCeApiEndpoint(false)}/` } if (import.meta.client && !nuxtApp.isHydrating) { const menu = ref(undefined) - const { key: _key, getCachedData: _getCachedData, ...clientFetchOptions } = useFetchOptions + const { + key: _key, + getCachedData: _getCachedData, + default: _default, + transform: _transform, + pick: _pick, + deep: _deep, + dedupe: _dedupe, + lazy: _lazy, + immediate: _immediate, + watch: _watch, + ...clientFetchOptions + } = useFetchOptions try { - menu.value = await $ceApi(clientFetchOptions, skipDrupalCeApiProxy)(menuPath.value) - } catch (error: unknown) { + menu.value = await $fetch(menuPath.value, { + ...clientFetchOptions, + baseURL: useFetchOptions.baseURL, + }) + } + catch (error: unknown) { const wrappedError = { value: error } overrideErrorHandler ? overrideErrorHandler(wrappedError) : menuErrorHandler(wrappedError) }