Skip to content

Commit

Permalink
fix: Add optional chaining for 'isArtificalRecoveredEventItem' (no-ch…
Browse files Browse the repository at this point in the history
…angelog) (#5860)

* fix: add optional chaining for isArtificalRecoveredEventItem

* fix: fix isArtificalRecoveredEventItem typo
  • Loading branch information
alexgrozav authored and netroy committed Apr 4, 2023
1 parent de58fb9 commit 35cf783
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/eventbus/MessageEventBus/recoverEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function recoverExecutionDataFromEventLogMessages(
[
{
json: {
isArtificalRecoveredEventItem: true,
isArtificialRecoveredEventItem: true,
},
pairedItem: undefined,
},
Expand Down
10 changes: 6 additions & 4 deletions packages/editor-ui/src/components/RunData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@
</div>

<div
v-else-if="hasNodeRun && dataCount > 0 && maxRunIndex === 0 && !isArtificalRecoveredEventItem"
v-else-if="
hasNodeRun && dataCount > 0 && maxRunIndex === 0 && !isArtificialRecoveredEventItem
"
v-show="!editMode.enabled"
:class="$style.itemsCount"
>
Expand Down Expand Up @@ -216,7 +218,7 @@
</n8n-text>
</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>
</div>

Expand Down Expand Up @@ -680,8 +682,8 @@ export default mixins(externalHooks, genericHelpers, nodeHelpers, pinData).exten
this.hasPinData),
);
},
isArtificalRecoveredEventItem(): boolean {
return this.inputData?.[0]?.json?.isArtificalRecoveredEventItem !== undefined ?? false;
isArtificialRecoveredEventItem(): boolean {
return this.inputData?.[0]?.json?.isArtificialRecoveredEventItem !== undefined ?? false;
},
subworkflowExecutionError(): Error | null {
return this.workflowsStore.subWorkflowExecutionError;
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/mixins/pushConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export const pushConnection = mixins(
for (const key of Object.keys(activeRunData)) {
if (
pushData.data.data.resultData.runData[key]?.[0]?.data?.main?.[0]?.[0]?.json
.isArtificalRecoveredEventItem === true &&
?.isArtificialRecoveredEventItem === true &&
activeRunData[key].length > 0
)
pushData.data.data.resultData.runData[key] = activeRunData[key];
Expand Down
10 changes: 5 additions & 5 deletions packages/editor-ui/src/utils/nodeViewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ export const getOutputSummary = (data: ITaskData[], nodeConnections: NodeInputCo
[targetInputIndex: string]: {
total: number;
iterations: number;
isArtificalRecoveredEventItem?: boolean;
isArtificialRecoveredEventItem?: boolean;
};
};
};
Expand All @@ -558,10 +558,10 @@ export const getOutputSummary = (data: ITaskData[], nodeConnections: NodeInputCo
run.data.main.forEach((output: INodeExecutionData[] | null, i: number) => {
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
// we do not want to count these items in the summary
// if (output?.[0]?.json?.isArtificalRecoveredEventItem) {
// if (output?.[0]?.json?.isArtificialRecoveredEventItem) {
// return outputMap;
// }

Expand Down Expand Up @@ -600,10 +600,10 @@ export const getOutputSummary = (data: ITaskData[], nodeConnections: NodeInputCo
};
}

if (output?.[0]?.json?.isArtificalRecoveredEventItem) {
if (output?.[0]?.json?.isArtificialRecoveredEventItem) {
outputMap[sourceOutputIndex][targetNodeName][
targetInputIndex
].isArtificalRecoveredEventItem = true;
].isArtificialRecoveredEventItem = true;
outputMap[sourceOutputIndex][targetNodeName][targetInputIndex].total = 0;
} else {
outputMap[sourceOutputIndex][targetNodeName][targetInputIndex].total += output
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2934,9 +2934,9 @@ export default mixins(
if (connection) {
const output = outputMap[sourceOutputIndex][targetNodeName][targetInputIndex];
if (output.isArtificalRecoveredEventItem) {
if (output.isArtificialRecoveredEventItem) {
NodeViewUtils.recoveredConnection(connection);
} else if ((!output || !output.total) && !output.isArtificalRecoveredEventItem) {
} else if ((!output || !output.total) && !output.isArtificialRecoveredEventItem) {
NodeViewUtils.resetConnection(connection);
} else {
NodeViewUtils.addConnectionOutputSuccess(connection, output);
Expand Down

0 comments on commit 35cf783

Please sign in to comment.