From 921eac6b35244669e131d67444aeb01508356026 Mon Sep 17 00:00:00 2001 From: Harshith Mohan Date: Sat, 13 Apr 2024 22:59:17 +0530 Subject: [PATCH] fix: signalr not connecting on logout and re-login (#867) --- src/core/middlewares/signalr.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/middlewares/signalr.ts b/src/core/middlewares/signalr.ts index e8eee88fe..828e73285 100644 --- a/src/core/middlewares/signalr.ts +++ b/src/core/middlewares/signalr.ts @@ -2,6 +2,7 @@ import { HttpTransportType, type HubConnection, HubConnectionBuilder, + HubConnectionState, JsonHubProtocol, LogLevel, } from '@microsoft/signalr'; @@ -106,7 +107,9 @@ next => async (action: UnknownAction) => { // register signalR after the user logged in if (action.type === Events.MAINPAGE_LOADED) { - if (connectionEvents !== undefined) return next(action); + if (connectionEvents !== undefined && connectionEvents.state !== HubConnectionState.Disconnected) { + return next(action); + } const connectionHub = '/signalr/aggregate?feeds=anidb,shoko,queue,network,avdump'; const protocol = new JsonHubProtocol();