fix: ComboBox filtering delay in contact merge search (#10968)
This commit is contained in:
@@ -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="
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user