fix: ComboBox filtering delay in contact merge search (#10968)
This commit is contained in:
@@ -50,6 +50,7 @@ const { t } = useI18n();
|
||||
</div>
|
||||
<ComboBox
|
||||
id="inbox"
|
||||
use-api-results
|
||||
:model-value="primaryContactId"
|
||||
:options="primaryContactList"
|
||||
:empty-state="
|
||||
|
||||
@@ -13,34 +13,14 @@ const props = defineProps({
|
||||
validator: value =>
|
||||
value.every(option => 'value' in option && 'label' in option),
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
searchPlaceholder: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
emptyState: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
message: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
hasError: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
placeholder: { type: String, default: '' },
|
||||
modelValue: { type: [String, Number], default: '' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
searchPlaceholder: { type: String, default: '' },
|
||||
emptyState: { type: String, default: '' },
|
||||
message: { type: String, default: '' },
|
||||
hasError: { type: Boolean, default: false },
|
||||
useApiResults: { type: Boolean, default: false }, // useApiResults prop to determine if search is handled by API
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'search']);
|
||||
@@ -54,6 +34,12 @@ const dropdownRef = ref(null);
|
||||
const comboboxRef = ref(null);
|
||||
|
||||
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();
|
||||
return props.options.filter(option =>
|
||||
option.label.toLowerCase().includes(searchTerm)
|
||||
|
||||
Reference in New Issue
Block a user