From bf1c518b3741dac6dc8fc8e6460d279c9bcb53a8 Mon Sep 17 00:00:00 2001 From: mntone <901816+mntone@users.noreply.github.com> Date: Sat, 22 Jun 2024 22:08:32 +0900 Subject: [PATCH] Fixes issue where realtime updates isn't working. --- src/modules/overlay/middlewares/index.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/modules/overlay/middlewares/index.ts b/src/modules/overlay/middlewares/index.ts index 1bee9b5..4945ac4 100644 --- a/src/modules/overlay/middlewares/index.ts +++ b/src/modules/overlay/middlewares/index.ts @@ -8,20 +8,19 @@ import { addTelemetry } from '@/telemetry/slicers' import type { RootState } from 'app/store' const overlay = (store: MiddlewareAPI) => (next: Dispatch) => (action: UnknownAction) => { - next(action) - + const result = next(action) const state = store.getState() // Return when match is not selected const matchId = state.overlay.match if (matchId === undefined) { - return + return result } // Return when match is not found - const currentSession = state.telemetry[matchId] + const currentSession = state.telemetry.entities[matchId] if (currentSession === undefined) { - return + return result } // Show powered-by and return if closed when realtime, @@ -31,7 +30,7 @@ const overlay = (store: MiddlewareAPI) => (next: Dispatch) if (inAddTelemetry) { store.dispatch(showPoweredby() as any) } - return + return result } if (!state.overlay.wave) { @@ -43,8 +42,9 @@ const overlay = (store: MiddlewareAPI) => (next: Dispatch) const notify = notifyOnQuotaMet || notifyOnWaveFinished if (notify && inAddTelemetry) { - const latestWave = currentSession?.waves.findLast((w): w is ShakeDefaultWave => w.wave !== 'extra') - if (latestWave) { + const latestWaveKey = currentSession.waveKeys.findLast(waveKey => waveKey !== 'extra') + if (latestWaveKey) { + const latestWave = currentSession.waves[latestWaveKey] as ShakeDefaultWave const latestUpdate = forceLast(latestWave.updates) // Notify upon quota met or wave finished @@ -80,6 +80,7 @@ const overlay = (store: MiddlewareAPI) => (next: Dispatch) } } } + return result } export default overlay