fix for not actually forcing reload when update fails
This commit is contained in:
parent
3184831ebb
commit
2bfcc822a3
|
|
@ -484,24 +484,25 @@ $(function (){
|
||||||
debug('update error', err);
|
debug('update error', err);
|
||||||
|
|
||||||
/* force a reset back to the latest server data */
|
/* force a reset back to the latest server data */
|
||||||
switchGameId(gameId);
|
switchGameId(gameId, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchGameId(newId){
|
function switchGameId(newId, force) {
|
||||||
let boardElem = $('#cb_board');
|
let boardElem = $('#cb_board');
|
||||||
let gameId = boardElem.data('gameId');
|
let gameId = boardElem.data('gameId');
|
||||||
|
|
||||||
debug('switching from ' + gameId + ' to ' + newId);
|
debug('switching from ' + gameId + ' to ' + newId);
|
||||||
if (newId === gameId) {
|
if (newId === gameId && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelGameCallback();
|
/* cancel to reload data, but keep polling if game ID will be the same */
|
||||||
|
cancelGameCallback(newId === gameId);
|
||||||
|
|
||||||
boardElem.data('gameId', newId);
|
boardElem.data('gameId', newId);
|
||||||
boardElem.data('modified', 0);
|
boardElem.data('modified', 0);
|
||||||
location.hash = '#/' + newId;
|
history.replaceState(null, document.title, '#/' + newId);
|
||||||
|
|
||||||
const notifyAfter = +new Date() + 2000;
|
const notifyAfter = +new Date() + 2000;
|
||||||
$(window).data('notifyAfter', +new Date() + 2000);
|
$(window).data('notifyAfter', +new Date() + 2000);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue