Skip to content

Commit

Permalink
Update use-qwik-speak.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Nov 25, 2023
1 parent 4a946b7 commit 818bec3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/qwik-speak/src/use-qwik-speak.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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$);
};

/**
Expand Down

0 comments on commit 818bec3

Please sign in to comment.