n8n-nodes-while-loop 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -64,10 +64,9 @@ class WhileLoop {
|
|
|
64
64
|
const conditionExpression = mode === "expression"
|
|
65
65
|
? this.getNodeParameter("conditionExpression", 0, "")
|
|
66
66
|
: "";
|
|
67
|
-
const state = this.getWorkflowStaticData("
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const loopState = state.__whileLoop[nodeKey] || { iteration: 0 };
|
|
67
|
+
const state = this.getWorkflowStaticData("node"); // safe context in n8n 2.x
|
|
68
|
+
state.loopState = state.loopState || { iteration: 0 };
|
|
69
|
+
const loopState = state.loopState;
|
|
71
70
|
const continueItems = [];
|
|
72
71
|
const doneItems = [];
|
|
73
72
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -113,15 +112,15 @@ class WhileLoop {
|
|
|
113
112
|
}
|
|
114
113
|
else {
|
|
115
114
|
// reset state for next execution
|
|
116
|
-
|
|
115
|
+
state.loopState = { iteration: 0 };
|
|
117
116
|
doneItems.push(items[i]);
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
if (continueItems.length) {
|
|
121
|
-
state.
|
|
120
|
+
state.loopState = loopState;
|
|
122
121
|
}
|
|
123
122
|
else {
|
|
124
|
-
|
|
123
|
+
state.loopState = { iteration: 0 };
|
|
125
124
|
}
|
|
126
125
|
return [continueItems, doneItems];
|
|
127
126
|
}
|