mirror of
https://github.com/frappe/books.git
synced 2024-11-08 14:50:56 +00:00
fix: prevent errors cause undef or null
This commit is contained in:
parent
b7810ee25e
commit
67e38e4729
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -188,7 +188,7 @@ export default {
|
||||
return emptyMessage;
|
||||
},
|
||||
async selectItem(d) {
|
||||
if (!d.action) {
|
||||
if (!d?.action) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -156,6 +156,10 @@ export default defineComponent({
|
||||
this.pageEnd = end;
|
||||
},
|
||||
setUpdateListeners() {
|
||||
if (!this.schemaName) {
|
||||
return;
|
||||
}
|
||||
|
||||
const listener = () => {
|
||||
this.updateData();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user