Skip to content

Commit 8dc2ebf

Browse files
committed
fix builder save
1 parent ac01b71 commit 8dc2ebf

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

app/javascript/template_builder/builder.vue

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,26 +3006,28 @@ export default {
30063006
this.save()
30073007
},
30083008
rebuildVariablesSchema ({ disable = true } = {}) {
3009-
const parsed = {}
3010-
30113009
const dynamicDocumentRef = this.documentRefs.find((e) => e.isDynamic)
30123010

3013-
this.documentRefs.forEach((ref) => {
3014-
if (ref.isDynamic) {
3015-
ref.updateVariablesSchema()
3016-
}
3017-
})
3011+
if (dynamicDocumentRef) {
3012+
const parsed = {}
30183013

3019-
this.dynamicDocuments.forEach((doc) => {
3020-
if (doc.variables_schema) {
3021-
dynamicDocumentRef.mergeSchemaProperties(parsed, doc.variables_schema)
3022-
}
3023-
})
3014+
this.documentRefs.forEach((ref) => {
3015+
if (ref.isDynamic) {
3016+
ref.updateVariablesSchema()
3017+
}
3018+
})
30243019

3025-
if (!this.template.variables_schema) {
3026-
this.template.variables_schema = parsed
3027-
} else {
3028-
dynamicDocumentRef.syncVariablesSchema(this.template.variables_schema, parsed, { disable })
3020+
this.dynamicDocuments.forEach((doc) => {
3021+
if (doc.variables_schema) {
3022+
dynamicDocumentRef.mergeSchemaProperties(parsed, doc.variables_schema)
3023+
}
3024+
})
3025+
3026+
if (!this.template.variables_schema) {
3027+
this.template.variables_schema = parsed
3028+
} else {
3029+
dynamicDocumentRef.syncVariablesSchema(this.template.variables_schema, parsed, { disable })
3030+
}
30293031
}
30303032
}
30313033
}

0 commit comments

Comments
 (0)