diff --git a/src/components/mini-widgets/VeryGenericIndicator.vue b/src/components/mini-widgets/VeryGenericIndicator.vue index 26702c0f5..14bf1aac9 100644 --- a/src/components/mini-widgets/VeryGenericIndicator.vue +++ b/src/components/mini-widgets/VeryGenericIndicator.vue @@ -324,25 +324,19 @@ watchThrottled( // Search for variable using fuzzy-finder const variableNameSearchString = ref('') -const variableNamesToShow = ref([]) const allVariablesNames = ref([]) const showVariableChooseModal = ref(false) const showIconChooseModal = ref(false) -watchThrottled( - [variableNameSearchString, allVariablesNames], - () => { - if (variableNameSearchString.value === '') { - variableNamesToShow.value = allVariablesNames.value - return - } +const variableNamesToShow = computed(() => { + if (variableNameSearchString.value === '') { + return allVariablesNames.value + } - const variableNameFuse = new Fuse(allVariablesNames.value, fuseOptions) - const filteredVariablesResult = variableNameFuse.search(variableNameSearchString.value) - variableNamesToShow.value = filteredVariablesResult.map((r) => r.item) - }, - { throttle: 300 } -) + const variableNameFuse = new Fuse(allVariablesNames.value, fuseOptions) + const filteredVariablesResult = variableNameFuse.search(variableNameSearchString.value) + return filteredVariablesResult.map((r) => r.item) +}) const chooseVariable = (variable: string): void => { miniWidget.value.options.variableName = variable