@@ -114,6 +114,8 @@ export function CreateGameReducer({ game, numPlayers, multiplayer }) {
114114 return ( state = initial , action ) => {
115115 switch ( action . type ) {
116116 case Actions . GAME_EVENT : {
117+ state = { ...state , deltalog : [ ] } ;
118+
117119 // Process game events only on the server.
118120 // These events like `endTurn` typically
119121 // contain code that may rely on secret state
@@ -135,8 +137,6 @@ export function CreateGameReducer({ game, numPlayers, multiplayer }) {
135137 return state ;
136138 }
137139
138- state = { ...state , deltalog : undefined } ;
139-
140140 const apiCtx = new ContextEnhancer (
141141 state . ctx ,
142142 game ,
@@ -152,6 +152,8 @@ export function CreateGameReducer({ game, numPlayers, multiplayer }) {
152152 }
153153
154154 case Actions . MAKE_MOVE : {
155+ state = { ...state , deltalog : [ ] } ;
156+
155157 // Check whether the game knows the move at all.
156158 if ( ! game . moveNames . includes ( action . payload . type ) ) {
157159 return state ;
@@ -175,8 +177,6 @@ export function CreateGameReducer({ game, numPlayers, multiplayer }) {
175177 return state ;
176178 }
177179
178- state = { ...state , deltalog : undefined } ;
179-
180180 const apiCtx = new ContextEnhancer (
181181 state . ctx ,
182182 game ,
0 commit comments