From b8f94314a53a31e51166cb1863e7a85b4501ec9d Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Fri, 6 Oct 2023 10:28:15 +1100 Subject: [PATCH] fix(@dpc-sdp/nuxt-ripple): fixed console error when request event was being fetched client side nuxt doesn't expose the useRequestEvent on the client, only the server so it was failing --- packages/nuxt-ripple/composables/use-merge-section-tags.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nuxt-ripple/composables/use-merge-section-tags.ts b/packages/nuxt-ripple/composables/use-merge-section-tags.ts index e0bba9eb97..f1a6e4eb40 100644 --- a/packages/nuxt-ripple/composables/use-merge-section-tags.ts +++ b/packages/nuxt-ripple/composables/use-merge-section-tags.ts @@ -12,9 +12,11 @@ const mergeTags = (existingTags: string, newTags: string): string => { export const useMergeSectionTags = async ( sectionCacheTags: any ): Promise => { + // event will be undefined if the request is on the client side const event = useRequestEvent() + // Section.io cache tags must be set on the response header to invalidate the cache after a change in drupal - if (sectionCacheTags) { + if (event && sectionCacheTags) { const currentResponseHeaders = getResponseHeaders(event) const currentSectionTags: string =