mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-25 06:04:54 +00:00
Merge pull request #189 from johndoe6345789/codex/modify-syncmonitormiddleware-to-check-requestid
Guard sync monitor tracking by requestId
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user