fix(presenter): fix resume after chat interruption + sync stateRef

stateRef was still 'resuming' when advanceRef.current() ran,
causing it to bail out. Now sync stateRef immediately before advance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-20 14:04:39 +01:00
parent eb263ce7a4
commit 9da9b323fc

View File

@@ -313,6 +313,7 @@ export function usePresenterMode({
clearTimer()
cancelSpeech()
setState('presenting')
stateRef.current = 'presenting'
const slideIdx = slideIndexRef.current
const script = getScriptForIndex(slideIdx)
@@ -345,8 +346,10 @@ export function usePresenterMode({
const resume = useCallback(() => {
setState('resuming')
stateRef.current = 'resuming'
timerRef.current = setTimeout(() => {
setState('presenting')
stateRef.current = 'presenting' // Sync ref immediately before calling advance
advanceRef.current()
}, 2000)
}, [])