fix for not notifying on next move after switching game

This commit is contained in:
Jesse D. McDonald 2020-05-09 13:05:32 -05:00
parent 327d7a74bc
commit a1a9eea758
1 changed files with 6 additions and 0 deletions

View File

@ -1276,6 +1276,12 @@ $(function (){
function notifyLocalMove(game, gameId) { function notifyLocalMove(game, gameId) {
if (!game) { if (!game) {
delete lastNotifyState[gameId]; delete lastNotifyState[gameId];
/* Preload the last-known state if we already have data for this game */
const localMeta = IO.getCachedMeta();
if (gameId in localMeta) {
notifyForGame(localMeta[gameId], gameId);
}
} else { } else {
lastNotifyState[gameId] = lastNotifyState[gameId] || {}; lastNotifyState[gameId] = lastNotifyState[gameId] || {};
lastNotifyState[gameId].moves = game.moves; lastNotifyState[gameId].moves = game.moves;