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 { index, key, level, parentKey, children } = processedOption;
const grouped = isNotEmpty(children); 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 }; this.focusedOptionInfo = { index, level, parentKey };
@ -646,7 +646,7 @@ export default {
return this.isValidOption(processedOption) && this.isSelected(processedOption); return this.isValidOption(processedOption) && this.isSelected(processedOption);
}, },
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() { findFirstOptionIndex() {
return this.visibleOptions.findIndex((processedOption) => this.isValidOption(processedOption)); return this.visibleOptions.findIndex((processedOption) => this.isValidOption(processedOption));
@ -819,7 +819,7 @@ export default {
return this.createProcessedOptions(this.options || []); return this.createProcessedOptions(this.options || []);
}, },
visibleOptions() { 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; return processedOption ? processedOption.children : this.processedOptions;
}, },

View File

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