koumoul-dev / vuetify-jsonschema-form

Create beautiful and low-effort forms that output valid data. Published on npm as @koumoul/vjsf.
https://koumoul-dev.github.io/vuetify-jsonschema-form/latest/
MIT License
538 stars 154 forks source link

Selection box state is not updated when model has changed #356

Open tkutz opened 2 years ago

tkutz commented 2 years ago

In my scenario I use oneOf to have a selection box and to display different form elements based on this selection. The whole form is embedded inside of a v-dialog. However, if I change the underlying model, the selection does not change. This means in my concrete case, when I select something, close the dialog, change the model, and open the dialog again, it still shows the old value (while the model is different by now). It works with a simple manually created v-select though.

Is there any option I am missing, or is this just a bug?

albanm commented 2 years ago

I don't fully understand the situation. Could you provide a codepen (the doc contains links to init codepens from the examples) ? Or at least a schema.

tkutz commented 2 years ago

Okay, I tried to reproduce the problem in a minimal example here: https://codepen.io/tkutz/pen/oNErLaW?editors=1011

When you klick the "toggle schema" button, the model changes, and the v-select gets updated, but the selection box created by vjsf does not update its value. Is there anything I am missing?

albanm commented 2 years ago

It looks like another variant of https://github.com/koumoul-dev/vuetify-jsonschema-form/issues/58

Once bound the model is only reactive one way.

tkutz commented 2 years ago

Okay thanks, I managed to get around the issue with the <v-if> workaround mentioned in #58.