From 7d75c6adc0270b9ffff50ca756292f65ad95597d Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Sun, 18 Jan 2026 18:22:00 +0000 Subject: [PATCH] Guard sync monitor tracking by requestId --- src/store/middleware/syncMonitorMiddleware.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/store/middleware/syncMonitorMiddleware.ts b/src/store/middleware/syncMonitorMiddleware.ts index 2ddfa92..df97aa0 100644 --- a/src/store/middleware/syncMonitorMiddleware.ts +++ b/src/store/middleware/syncMonitorMiddleware.ts @@ -107,21 +107,18 @@ export const createSyncMonitorMiddleware = (): Middleware => { const isFulfilledAction = asyncThunkActions.some((prefix) => action.type === `${prefix}/fulfilled`) const isRejectedAction = asyncThunkActions.some((prefix) => action.type === `${prefix}/rejected`) - if (isPendingAction) { - const operationId = action.meta?.requestId || `${action.type}-${Date.now()}` - syncMonitor.startOperation(operationId) + if (isPendingAction && action.meta?.requestId) { + syncMonitor.startOperation(action.meta.requestId) } const result = next(action) - if (isFulfilledAction) { - const operationId = action.meta?.requestId || `${action.type}-${Date.now()}` - syncMonitor.endOperation(operationId, true) + if (isFulfilledAction && action.meta?.requestId) { + syncMonitor.endOperation(action.meta.requestId, true) } - if (isRejectedAction) { - const operationId = action.meta?.requestId || `${action.type}-${Date.now()}` - syncMonitor.endOperation(operationId, false) + if (isRejectedAction && action.meta?.requestId) { + syncMonitor.endOperation(action.meta.requestId, false) } return result