@@ -169,6 +169,8 @@ export function previousPhase() {
169169export function displayPhase ( skipMessages = false ) {
170170 let index = gameState . phaseIndex
171171 if ( index >= gameState . gameData . phases . length ) {
172+ // FIXME: Calling this here as well as in nextPhase is unneeded
173+
172174 displayFinalPhase ( )
173175 logger . log ( "Displayed final phase." )
174176 return ;
@@ -221,10 +223,17 @@ export function displayPhase(skipMessages = false) {
221223 // Only animate if not the first phase and animations are requested
222224 if ( ! isFirstPhase && ! skipMessages ) {
223225 if ( previousPhase ) {
224- // Don't create animations immediately if messages are still playing
225- // The main loop will handle this when messages finish
226- if ( ! gameState . messagesPlaying ) {
227- createAnimationsForNextPhase ( ) ;
226+ try {
227+ // Don't create animations immediately if messages are still playing
228+ // The main loop will handle this when messages finish
229+ if ( ! gameState . messagesPlaying ) {
230+ createAnimationsForNextPhase ( ) ;
231+ }
232+ } catch ( error ) {
233+ console . warn ( `Caught below error when attempting to create animations. Moving on without them.` )
234+ console . error ( error )
235+ initUnits ( gameState . phaseIndex )
236+
228237 }
229238 }
230239 } else {
@@ -282,7 +291,7 @@ export function advanceToNextPhase() {
282291 // In streaming mode, add extra delay before speech to ensure phase is fully displayed
283292 const isStreamingMode = import . meta. env . VITE_STREAMING_MODE === 'True' || import . meta. env . VITE_STREAMING_MODE === 'true' ;
284293 const speechDelay = isStreamingMode ? 2000 : 0 ; // 2 second delay in streaming mode
285-
294+
286295 // First show summary if available
287296 if ( currentPhase . summary && currentPhase . summary . trim ( ) !== '' ) {
288297 // Delay speech in streaming mode
0 commit comments