Skip to content

Commit ffe4461

Browse files
committed
Fix TypeError in cylc message mutation form
1 parent cb0032a commit ffe4461

File tree

1 file changed

+10
-6
lines changed
  • src/components/graphqlFormGenerator/components

1 file changed

+10
-6
lines changed

src/components/graphqlFormGenerator/components/List.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
<template>
1919
<v-list density="compact">
2020
<v-list-item
21-
v-for="(item, index) in modelValue"
21+
v-for="(item, index) in model"
2222
:key="index"
2323
>
2424
<!-- The input -->
2525
<FormInput
26-
v-model="modelValue[index]"
26+
v-model="model[index]"
2727
:gqlType="gqlType.ofType"
2828
:types="types"
2929
ref="inputs"
@@ -78,16 +78,20 @@ export default {
7878
7979
inheritAttrs: false,
8080
81+
created () {
82+
this.model ??= []
83+
},
84+
8185
methods: {
8286
/** Add an item to the list. */
8387
add () {
8488
const newInput = getNullValue(this.gqlType.ofType, this.types)
8589
let index = 0
8690
if (this.addAtStart) {
87-
this.modelValue.unshift(newInput)
91+
this.model.unshift(newInput)
8892
} else {
89-
index = this.modelValue.length
90-
this.modelValue.push(newInput)
93+
index = this.model.length
94+
this.model.push(newInput)
9195
}
9296
// this is not ideal, but I believe whats happening is the new (wrapper) component is created over the first tick from the new array item
9397
// the component content is created over the next tick (including the input)
@@ -101,7 +105,7 @@ export default {
101105
102106
/** Remove the item at `index` from the list. */
103107
remove (index) {
104-
this.modelValue.splice(index, 1)
108+
this.model.splice(index, 1)
105109
}
106110
},
107111

0 commit comments

Comments
 (0)