Fix TypeError in cylc message mutation form#2302
Conversation
| this.modelValue.unshift(newInput) | ||
| this.model.unshift(newInput) |
There was a problem hiding this comment.
Mixins did not make it fun to figure out where modelValue is coming from, but it's here:
cylc-ui/src/components/graphqlFormGenerator/mixins.js
Lines 23 to 37 in cb0032a
We shouldn't be mutating the prop, instead we should be using the model getter/setter
This comment was marked as resolved.
This comment was marked as resolved.
|
That's expected, the format of messages is |
|
Ach right, that makes sense. Cool, truth be told, we don't really want to expose the This is a genuine fix to the form generator fixing a bug which could occur in any other mutation, so well worth doing irrespective. |
|
@wxtim, could you give this a quick once-over. This PR is basically a composition API refactor (you can actually test the bugfix part with Don't worry about the confusing message command form (see above). |
|
An advantage of the composition API is (since Vue 3.5) it is much easier to define v-models on components. This makes it easier to avoid mutating props, which is flagged up in newer versions of eslint-plugin-vue (#2142 (though I don't think the plugin can tell when a prop is added by a mixin)) |
| import { formElementProps, useFormElement } from '@/components/graphqlFormGenerator/mixins' | ||
| import { RULES } from '@/components/graphqlFormGenerator/components/vuetify' | ||
|
|
||
| /** |
There was a problem hiding this comment.
This feels like it ought to be in a general utilities module?

Closes #2410
Bug
Results in nothing happening and this error:
Check List
CONTRIBUTING.mdand added my name as a Code Contributor.