diff --git a/packages/nc-gui-v2/utils/NcAutocompleteTree.ts b/packages/nc-gui-v2/utils/NcAutocompleteTree.ts index 23faeaca4f..96f1675a0b 100644 --- a/packages/nc-gui-v2/utils/NcAutocompleteTree.ts +++ b/packages/nc-gui-v2/utils/NcAutocompleteTree.ts @@ -37,6 +37,7 @@ export class NcAutocompleteTree { } root.value = root.value || [] root.value.push(word) + root.isLeaf = true } find(word: string) { @@ -48,12 +49,11 @@ export class NcAutocompleteTree { return null // if not found return null } } - return root // return the root where it ends search } traverse(root: Node) { - if (root.value && root.value.length) { + if (root.isLeaf) { this.suggestions.push(...root.value) } @@ -70,6 +70,8 @@ export class NcAutocompleteTree { return this.suggestions } // cannot suggest anything + this.suggestions.push(...root.value) + const children = root.children let spread = 0