fix: ComboBox filtering delay in contact merge search (#10968)

This commit is contained in:
Sivin Varghese
2025-02-25 17:21:43 +05:30
committed by GitHub
parent 35c69fc282
commit 4d588ae618
2 changed files with 15 additions and 28 deletions

View File

@@ -50,6 +50,7 @@ const { t } = useI18n();
</div> </div>
<ComboBox <ComboBox
id="inbox" id="inbox"
use-api-results
:model-value="primaryContactId" :model-value="primaryContactId"
:options="primaryContactList" :options="primaryContactList"
:empty-state=" :empty-state="

View File

@@ -13,34 +13,14 @@ const props = defineProps({
validator: value => validator: value =>
value.every(option => 'value' in option && 'label' in option), value.every(option => 'value' in option && 'label' in option),
}, },
placeholder: { placeholder: { type: String, default: '' },
type: String, modelValue: { type: [String, Number], default: '' },
default: '', disabled: { type: Boolean, default: false },
}, searchPlaceholder: { type: String, default: '' },
modelValue: { emptyState: { type: String, default: '' },
type: [String, Number], message: { type: String, default: '' },
default: '', hasError: { type: Boolean, default: false },
}, useApiResults: { type: Boolean, default: false }, // useApiResults prop to determine if search is handled by API
disabled: {
type: Boolean,
default: false,
},
searchPlaceholder: {
type: String,
default: '',
},
emptyState: {
type: String,
default: '',
},
message: {
type: String,
default: '',
},
hasError: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(['update:modelValue', 'search']); const emit = defineEmits(['update:modelValue', 'search']);
@@ -54,6 +34,12 @@ const dropdownRef = ref(null);
const comboboxRef = ref(null); const comboboxRef = ref(null);
const filteredOptions = computed(() => { const filteredOptions = computed(() => {
// For API search, don't filter options locally
if (props.useApiResults && search.value) {
return props.options;
}
// For local search, filter options based on search term
const searchTerm = search.value.toLowerCase(); const searchTerm = search.value.toLowerCase();
return props.options.filter(option => return props.options.filter(option =>
option.label.toLowerCase().includes(searchTerm) option.label.toLowerCase().includes(searchTerm)