Skip to content

Commit e99ae89

Browse files
fix: Ensure onBoundary is always fired after onStart
1 parent 8d4aa29 commit e99ae89

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

package/src/hooks.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ export function useSpeechInternal({
206206
window.addEventListener("beforeunload", clearQueueUnload);
207207
setState({ stopReason: "auto" });
208208
highlightRef.current = true;
209+
if (directiveRef.current.event || directiveRef.current.delay) reset();
210+
else onStart?.();
209211
onBoundary?.({ progress: getProgress(offset, speechText.length) });
210-
if (directiveRef.current.event || directiveRef.current.delay) return reset();
211-
onStart?.();
212212
}
213213

214214
async function stopEventHandler() {

0 commit comments

Comments
 (0)