Skip to content

Commit edbcb89

Browse files
committed
fix for sorting: a value of 0 was not pushed to array
1 parent 24d853c commit edbcb89

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

apps/vps-web/src/tests/sort-flow-with-input.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('sort flow with input', () => {
99
test('runs sort flow with input', async () => {
1010
const flowEngine = new RuntimeFlowEngine();
1111
flowEngine.initialize(flow.flows.flow.nodes);
12-
const result = await flowEngine.run([5, 4, 3, 2, 1]);
12+
const result = await flowEngine.run([5, 4, 3, 2, 1, 0]);
1313
console.log('result', result);
1414
expect(Array.isArray(result)).toBe(true);
1515

@@ -19,6 +19,6 @@ describe('sort flow with input', () => {
1919
}
2020
});
2121

22-
expect(result.length).toBe(5);
22+
expect(result.length).toBe(6);
2323
});
2424
});

libs/web-flow-executor/src/nodes/scoped-variable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const getScopedVariable =
140140
scopedData[scopeId][data.index] = value;
141141
}
142142
}
143-
} else if (data.push) {
143+
} else if (data.push !== undefined && data.push !== null) {
144144
// data needs to be pushed 'raw' without convertDataToType
145145
// .. convertDataToType converts to array when fieldValueType is array
146146
// .. and here you want to push a value to that array
@@ -166,7 +166,7 @@ export const getScopedVariable =
166166
currentValue[data.index] = value;
167167
}
168168
}
169-
} else if (data.push) {
169+
} else if (data.push !== undefined && data.push !== null) {
170170
// data needs to be pushed 'raw' without convertDataToType
171171
// .. convertDataToType converts to array when fieldValueType is array
172172
// .. and here you want to push a value to that array

0 commit comments

Comments
 (0)