fix store content bug (#410)

This commit is contained in:
Favour Olayinka 2024-05-14 18:35:56 +01:00 committed by GitHub
parent 4f3b37e485
commit 12e5546ff3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -105,6 +105,7 @@ export const useWorkingFormStore = defineStore("working_form", {
}, },
addBlock(type, index = null) { addBlock(type, index = null) {
this.selectedFieldIndex = index
this.blockForm.type = type this.blockForm.type = type
this.blockForm.name = defaultBlockNames[type] this.blockForm.name = defaultBlockNames[type]
const newBlock = this.prefillDefault(this.blockForm.data()) const newBlock = this.prefillDefault(this.blockForm.data())
@ -135,7 +136,7 @@ export const useWorkingFormStore = defineStore("working_form", {
newFields.push(newBlock) newFields.push(newBlock)
this.content.properties = newFields this.content.properties = newFields
this.openSettingsForField( this.openSettingsForField(
this.form.properties.length - 1, this.content.properties.length - 1,
) )
} else { } else {
const fieldIndex = typeof index === "number" ? index : this.selectedFieldIndex + 1 const fieldIndex = typeof index === "number" ? index : this.selectedFieldIndex + 1