diff --git a/fyo/core/converter.ts b/fyo/core/converter.ts index 03c2ed58..180bc802 100644 --- a/fyo/core/converter.ts +++ b/fyo/core/converter.ts @@ -37,6 +37,7 @@ export class Converter { schemaName: string, rawValueMap: RawValueMap | RawValueMap[] ): DocValueMap | DocValueMap[] { + rawValueMap ??= {}; if (Array.isArray(rawValueMap)) { return rawValueMap.map((dv) => this.#toDocValueMap(schemaName, dv)); } else { @@ -48,6 +49,7 @@ export class Converter { schemaName: string, docValueMap: DocValueMap | DocValueMap[] ): RawValueMap | RawValueMap[] { + docValueMap ??= {}; if (Array.isArray(docValueMap)) { return docValueMap.map((dv) => this.#toRawValueMap(schemaName, dv)); } else { diff --git a/reports/AccountReport.ts b/reports/AccountReport.ts index c2f88e1a..4f13e96f 100644 --- a/reports/AccountReport.ts +++ b/reports/AccountReport.ts @@ -551,7 +551,7 @@ function pruneAccountTree(accountTree: AccountTree) { function getPrunedChildren(children: AccountTreeNode[]): AccountTreeNode[] { return children.filter((child) => { - if (child.children) { + if (child.children?.length) { child.children = getPrunedChildren(child.children); } diff --git a/src/components/Controls/AutoComplete.vue b/src/components/Controls/AutoComplete.vue index 355dca3f..04f2860a 100644 --- a/src/components/Controls/AutoComplete.vue +++ b/src/components/Controls/AutoComplete.vue @@ -153,8 +153,11 @@ export default { .map(({ item }) => item); }, setSuggestion(suggestion) { - this.linkValue = suggestion.label; - this.triggerChange(suggestion.value); + if (suggestion) { + this.linkValue = suggestion.label; + this.triggerChange(suggestion.value); + } + this.toggleDropdown(false); }, onFocus(e, toggleDropdown) { diff --git a/src/components/Dropdown.vue b/src/components/Dropdown.vue index b6a9dae7..beed8f2e 100644 --- a/src/components/Dropdown.vue +++ b/src/components/Dropdown.vue @@ -188,7 +188,7 @@ export default { return emptyMessage; }, async selectItem(d) { - if (!d.action) { + if (!d?.action) { return; } diff --git a/src/pages/ListView/List.vue b/src/pages/ListView/List.vue index f87cd4fd..bbbe36c3 100644 --- a/src/pages/ListView/List.vue +++ b/src/pages/ListView/List.vue @@ -156,6 +156,10 @@ export default defineComponent({ this.pageEnd = end; }, setUpdateListeners() { + if (!this.schemaName) { + return; + } + const listener = () => { this.updateData(); };