From 818bec3b50fdb0f8c61f83a80b6f9eb4d92056da Mon Sep 17 00:00:00 2001 From: Roberto Simonetti Date: Sat, 25 Nov 2023 15:05:59 +0100 Subject: [PATCH] Update use-qwik-speak.tsx --- packages/qwik-speak/src/use-qwik-speak.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/qwik-speak/src/use-qwik-speak.tsx b/packages/qwik-speak/src/use-qwik-speak.tsx index a37dc7b..1ff5410 100644 --- a/packages/qwik-speak/src/use-qwik-speak.tsx +++ b/packages/qwik-speak/src/use-qwik-speak.tsx @@ -1,4 +1,4 @@ -import { $, component$, getLocale, Slot, useContextProvider, useOnDocument, useTask$ } from '@builder.io/qwik'; +import { $, component$, getLocale, Slot, useContextProvider, useOnWindow, useTask$ } from '@builder.io/qwik'; import { isDev, isServer } from '@builder.io/qwik/build'; import type { SpeakConfig, SpeakLocale, SpeakState, TranslationFn } from './types'; @@ -89,7 +89,7 @@ export const useQwikSpeak = (props: QwikSpeakProps) => { } }); - // Resume shared context on client + // Resume Qwik Speak context on client const resumeContext$ = $(() => { const { locale, translation, config } = state; // Set Qwik Speak client context @@ -124,7 +124,8 @@ export const useQwikSpeak = (props: QwikSpeakProps) => { } }); - useOnDocument('DOMContentLoaded', resumeContext$); + // The load event is fired when the whole page has loaded + useOnWindow('load', resumeContext$); }; /**