Skip to content

Commit

Permalink
address disconnect on site.reload timing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
schlawg committed Sep 18, 2024
1 parent 1cfb13c commit 555cad5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion ui/@types/lichess/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ interface SocketI {
send: SocketSend;
sign(s: string): void;
destroy(): void;
disconnect(): void;
}

interface LichessSpeech {
Expand Down
2 changes: 1 addition & 1 deletion ui/common/src/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export default class StrongSocket implements SocketI {
this.ws = undefined;
};

disconnect = (): void => {
private disconnect = (): void => {
const ws = this.ws;
if (ws) {
this.debug('Disconnect');
Expand Down
2 changes: 1 addition & 1 deletion ui/site/src/reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const reload = (err?: any) => {
if (err) console.warn(err);
if (redirectInProgress) return;
unload.expected = true;
site.socket.disconnect();
site.socket.destroy();
if (location.hash) location.reload();
else location.assign(location.href);
};

0 comments on commit 555cad5

Please sign in to comment.