Skip to content

Commit d9093e9

Browse files
committed
ui: seed default-on toggles in zone wizard while hidden
StaticInputsForm.fillValue() only seeded defaults for currently-displayed fields, so a display-gated switch with checked:true bound to an undefined value and rendered as off once revealed. Seed checked switch/checkbox fields even while hidden, so the Linstor 'Allow self-signed certificate' toggle defaults on in the zone creation wizard.
1 parent 2658e45 commit d9093e9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ui/src/views/infra/zone/StaticInputsForm.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ export default {
187187
this.setRules(field)
188188
const fieldExists = this.isDisplayInput(field)
189189
if (!fieldExists) {
190+
// A display-gated toggle that defaults on (checked: true) must be seeded while still
191+
// hidden, otherwise it binds to an undefined value and shows off once it becomes visible.
192+
if ((field.switch || field.checkbox) && field.checked) {
193+
this.form[field.key] = true
194+
}
190195
return
191196
}
192197
if (field.key === 'agentUserName' && !this.getPrefilled(field)) {

0 commit comments

Comments
 (0)