@@ -47,9 +47,8 @@ import { setRepetitionRunData } from '../../core/state/workflow/workflowSlice';
47
47
import { getRepetitionName } from '../common/LoopsPager/helper' ;
48
48
import { DropZone } from '../connections/dropzone' ;
49
49
import { MessageBarType } from '@fluentui/react' ;
50
- import { RunService , useNodeIndex } from '@microsoft/logic-apps-shared' ;
50
+ import { isNullOrUndefined , RunService , useNodeIndex } from '@microsoft/logic-apps-shared' ;
51
51
import { Card } from '@microsoft/designer-ui' ;
52
- import type { LogicAppsV2 } from '@microsoft/logic-apps-shared' ;
53
52
import { memo , useCallback , useEffect , useMemo , useState } from 'react' ;
54
53
import { useDrag } from 'react-dnd' ;
55
54
import { useIntl } from 'react-intl' ;
@@ -79,7 +78,7 @@ const DefaultNode = ({ targetPosition = Position.Top, sourcePosition = Position.
79
78
const nodesMetaData = useNodesMetadata ( ) ;
80
79
const repetitionName = getRepetitionName ( parentRunIndex , id , nodesMetaData , operationsInfo ) ;
81
80
const isSecureInputsOutputs = useSecureInputsOutputs ( id ) ;
82
- const { status : statusRun , error : errorRun , code : codeRun , repetitionCount } = runData ?? { } ;
81
+ const { status : statusRun , error : errorRun , code : codeRun } = runData ?? { } ;
83
82
84
83
const suppressDefaultNodeSelect = useSuppressDefaultNodeSelectFunctionality ( ) ;
85
84
const nodeSelectCallbackOverride = useNodeSelectAdditionalCallback ( ) ;
@@ -101,22 +100,27 @@ const DefaultNode = ({ targetPosition = Position.Top, sourcePosition = Position.
101
100
return RunService ( ) . getRepetition ( { nodeId : id , runId : runInstance ?. id } , repetitionName ) ;
102
101
} ;
103
102
104
- const onRunRepetitionSuccess = async ( runDefinition : LogicAppsV2 . RunInstanceDefinition ) => {
105
- dispatch ( setRepetitionRunData ( { nodeId : id , runData : runDefinition . properties as any } ) ) ;
106
- } ;
107
-
108
- const { refetch , isFetching : isRepetitionLoading } = useQuery < any > (
103
+ const {
104
+ refetch ,
105
+ isFetching : isRepetitionLoading ,
106
+ data : repetitionData ,
107
+ } = useQuery < any > (
109
108
[ 'runInstance' , { nodeId : id , runId : runInstance ?. id , repetitionName, parentStatus : parenRunData ?. status } ] ,
110
109
getRunRepetition ,
111
110
{
112
111
refetchOnWindowFocus : false ,
113
112
initialData : null ,
114
113
refetchIntervalInBackground : true ,
115
- onSuccess : onRunRepetitionSuccess ,
116
- enabled : parentRunIndex !== undefined && isMonitoringView && repetitionCount !== undefined ,
114
+ enabled : parentRunIndex !== undefined && isMonitoringView ,
117
115
}
118
116
) ;
119
117
118
+ useEffect ( ( ) => {
119
+ if ( ! isNullOrUndefined ( repetitionData ) ) {
120
+ dispatch ( setRepetitionRunData ( { nodeId : id , runData : repetitionData . properties as any } ) ) ;
121
+ }
122
+ } , [ dispatch , id , repetitionData , runInstance ?. id ] ) ;
123
+
120
124
useEffect ( ( ) => {
121
125
if ( parentRunIndex !== undefined && isMonitoringView ) {
122
126
refetch ( ) ;
0 commit comments