Skip to content

Commit cb84dbd

Browse files
committed
fix: bridge mutation updates on pipeline changes
1 parent 433d2f2 commit cb84dbd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/components/Bridge/index.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,18 @@ export default function Bridge({ data, update, remove, schema, copy, names }) {
4444
let mutations = currentState.current.mutations.map((m) => m);
4545

4646
if (currentState.current.workflow.length > workflow.length) {
47+
// remove the mutations for the leaving job
4748
mutations = mutations
4849
.slice(0, mutationIndex)
4950
.concat(mutations.slice(mutationIndex + 1));
51+
} else if (currentState.current.workflow.length < workflow.length) {
52+
// add a new slot at the mutation index for the new job
53+
mutations = mutations
54+
.slice(0, mutationIndex)
55+
.concat([[]])
56+
.concat(mutations.slice(mutationIndex));
5057
} else {
58+
// replace the slot by an empty array
5159
mutations = mutations
5260
.slice(0, mutationIndex)
5361
.concat([[]])

0 commit comments

Comments
 (0)