fix: Add optional chaining for 'isArtificalRecoveredEventItem' (no-changelog) (#5860)

* fix: add optional chaining for isArtificalRecoveredEventItem

* fix: fix isArtificalRecoveredEventItem typo
This commit is contained in:
Alex Grozav 2023-04-03 16:04:59 +03:00 committed by कारतोफ्फेलस्क्रिप्ट™
parent de58fb9860
commit 35cf783e83
5 changed files with 15 additions and 13 deletions

View file

@ -108,7 +108,7 @@ export async function recoverExecutionDataFromEventLogMessages(
[ [
{ {
json: { json: {
isArtificalRecoveredEventItem: true, isArtificialRecoveredEventItem: true,
}, },
pairedItem: undefined, pairedItem: undefined,
}, },

View file

@ -162,7 +162,9 @@
</div> </div>
<div <div
v-else-if="hasNodeRun && dataCount > 0 && maxRunIndex === 0 && !isArtificalRecoveredEventItem" v-else-if="
hasNodeRun && dataCount > 0 && maxRunIndex === 0 && !isArtificialRecoveredEventItem
"
v-show="!editMode.enabled" v-show="!editMode.enabled"
:class="$style.itemsCount" :class="$style.itemsCount"
> >
@ -216,7 +218,7 @@
</n8n-text> </n8n-text>
</div> </div>
<div v-else-if="hasNodeRun && isArtificalRecoveredEventItem" :class="$style.center"> <div v-else-if="hasNodeRun && isArtificialRecoveredEventItem" :class="$style.center">
<slot name="recovered-artifical-output-data"></slot> <slot name="recovered-artifical-output-data"></slot>
</div> </div>
@ -680,8 +682,8 @@ export default mixins(externalHooks, genericHelpers, nodeHelpers, pinData).exten
this.hasPinData), this.hasPinData),
); );
}, },
isArtificalRecoveredEventItem(): boolean { isArtificialRecoveredEventItem(): boolean {
return this.inputData?.[0]?.json?.isArtificalRecoveredEventItem !== undefined ?? false; return this.inputData?.[0]?.json?.isArtificialRecoveredEventItem !== undefined ?? false;
}, },
subworkflowExecutionError(): Error | null { subworkflowExecutionError(): Error | null {
return this.workflowsStore.subWorkflowExecutionError; return this.workflowsStore.subWorkflowExecutionError;

View file

@ -295,7 +295,7 @@ export const pushConnection = mixins(
for (const key of Object.keys(activeRunData)) { for (const key of Object.keys(activeRunData)) {
if ( if (
pushData.data.data.resultData.runData[key]?.[0]?.data?.main?.[0]?.[0]?.json pushData.data.data.resultData.runData[key]?.[0]?.data?.main?.[0]?.[0]?.json
.isArtificalRecoveredEventItem === true && ?.isArtificialRecoveredEventItem === true &&
activeRunData[key].length > 0 activeRunData[key].length > 0
) )
pushData.data.data.resultData.runData[key] = activeRunData[key]; pushData.data.data.resultData.runData[key] = activeRunData[key];

View file

@ -544,7 +544,7 @@ export const getOutputSummary = (data: ITaskData[], nodeConnections: NodeInputCo
[targetInputIndex: string]: { [targetInputIndex: string]: {
total: number; total: number;
iterations: number; iterations: number;
isArtificalRecoveredEventItem?: boolean; isArtificialRecoveredEventItem?: boolean;
}; };
}; };
}; };
@ -558,10 +558,10 @@ export const getOutputSummary = (data: ITaskData[], nodeConnections: NodeInputCo
run.data.main.forEach((output: INodeExecutionData[] | null, i: number) => { run.data.main.forEach((output: INodeExecutionData[] | null, i: number) => {
const sourceOutputIndex = i; const sourceOutputIndex = i;
// executionData that was recovered by recoverEvents in the CLI will have an isArtificalRecoveredEventItem property // executionData that was recovered by recoverEvents in the CLI will have an isArtificialRecoveredEventItem property
// to indicate that it was not part of the original executionData // to indicate that it was not part of the original executionData
// we do not want to count these items in the summary // we do not want to count these items in the summary
// if (output?.[0]?.json?.isArtificalRecoveredEventItem) { // if (output?.[0]?.json?.isArtificialRecoveredEventItem) {
// return outputMap; // return outputMap;
// } // }
@ -600,10 +600,10 @@ export const getOutputSummary = (data: ITaskData[], nodeConnections: NodeInputCo
}; };
} }
if (output?.[0]?.json?.isArtificalRecoveredEventItem) { if (output?.[0]?.json?.isArtificialRecoveredEventItem) {
outputMap[sourceOutputIndex][targetNodeName][ outputMap[sourceOutputIndex][targetNodeName][
targetInputIndex targetInputIndex
].isArtificalRecoveredEventItem = true; ].isArtificialRecoveredEventItem = true;
outputMap[sourceOutputIndex][targetNodeName][targetInputIndex].total = 0; outputMap[sourceOutputIndex][targetNodeName][targetInputIndex].total = 0;
} else { } else {
outputMap[sourceOutputIndex][targetNodeName][targetInputIndex].total += output outputMap[sourceOutputIndex][targetNodeName][targetInputIndex].total += output

View file

@ -2934,9 +2934,9 @@ export default mixins(
if (connection) { if (connection) {
const output = outputMap[sourceOutputIndex][targetNodeName][targetInputIndex]; const output = outputMap[sourceOutputIndex][targetNodeName][targetInputIndex];
if (output.isArtificalRecoveredEventItem) { if (output.isArtificialRecoveredEventItem) {
NodeViewUtils.recoveredConnection(connection); NodeViewUtils.recoveredConnection(connection);
} else if ((!output || !output.total) && !output.isArtificalRecoveredEventItem) { } else if ((!output || !output.total) && !output.isArtificialRecoveredEventItem) {
NodeViewUtils.resetConnection(connection); NodeViewUtils.resetConnection(connection);
} else { } else {
NodeViewUtils.addConnectionOutputSuccess(connection, output); NodeViewUtils.addConnectionOutputSuccess(connection, output);