Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb0a817

Browse files
authored
fix: hide client disconnect error msg (#530)
1 parent 225b9fe commit eb0a817

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

querybook/webapp/lib/socketio-manager.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function getSocketFromManager(nameSpace: string) {
1919
return socketIOManager.socket(nameSpace);
2020
}
2121

22-
const sendToastForError = debounce(
22+
const sendErrorToastDebounced = debounce(
2323
(error) => {
2424
toast.error(String(error));
2525
},
@@ -39,28 +39,28 @@ export default {
3939
// wait for connection
4040
await new Promise<void>((resolve) => {
4141
socket.on('connect', () => {
42-
sendToastForError.cancel();
42+
sendErrorToastDebounced.cancel();
4343
if (onConnection) {
4444
onConnection(socket);
4545
}
4646
resolve();
4747
});
4848

4949
socket.on('connect_error', (error: Error) => {
50-
sendToastForError(error.toString());
50+
sendErrorToastDebounced(error.toString());
5151
});
5252

5353
socket.on('connect_timeout', (timeout) => {
54-
sendToastForError(timeout);
54+
sendErrorToastDebounced(timeout);
5555
});
5656

5757
socket.on('disconnect', (reason: string) => {
5858
if (reason === 'io server disconnect') {
59-
sendToastForError(
59+
sendErrorToastDebounced(
6060
'Websocket was disconnected due to authentication issue. Please try to refresh the page.'
6161
);
62-
} else {
63-
sendToastForError(
62+
} else if (reason !== 'io client disconnect') {
63+
sendErrorToastDebounced(
6464
`Websocket was disconnected due to: ${reason}`
6565
);
6666
}

0 commit comments

Comments
 (0)