pull/7291/head
Cagatay Civici 2025-02-20 14:11:12 +03:00
commit 020c5a4165
2 changed files with 4 additions and 4 deletions

View File

@ -309,7 +309,7 @@ export default {
const { index, key, level, parentKey, children } = processedOption;
const grouped = isNotEmpty(children);
const activeOptionPath = this.activeOptionPath.filter((p) => p.parentKey !== parentKey && p.parentKey !== key);
const activeOptionPath = this.activeOptionPath ? this.activeOptionPath.filter((p) => p.parentKey !== parentKey && p.parentKey !== key) : [];
this.focusedOptionInfo = { index, level, parentKey };
@ -646,7 +646,7 @@ export default {
return this.isValidOption(processedOption) && this.isSelected(processedOption);
},
isSelected(processedOption) {
return this.activeOptionPath.some((p) => p.key === processedOption.key);
return this.activeOptionPath && this.activeOptionPath.some((p) => p.key === processedOption.key);
},
findFirstOptionIndex() {
return this.visibleOptions.findIndex((processedOption) => this.isValidOption(processedOption));
@ -819,7 +819,7 @@ export default {
return this.createProcessedOptions(this.options || []);
},
visibleOptions() {
const processedOption = this.activeOptionPath.find((p) => p.key === this.focusedOptionInfo.parentKey);
const processedOption = this.activeOptionPath && this.activeOptionPath.find((p) => p.key === this.focusedOptionInfo.parentKey);
return processedOption ? processedOption.children : this.processedOptions;
},

View File

@ -131,7 +131,7 @@ export default {
return equals(this.value, processedOption?.option);
},
isOptionActive(processedOption) {
return this.activeOptionPath.some((path) => path.key === processedOption.key);
return this.activeOptionPath && this.activeOptionPath.some((path) => path.key === processedOption.key);
},
isOptionFocused(processedOption) {
return this.focusedOptionId === this.getOptionId(processedOption);