diff --git a/components/autocomplete.vue b/components/autocomplete.vue index 1445b76..0ec4ece 100644 --- a/components/autocomplete.vue +++ b/components/autocomplete.vue @@ -33,6 +33,7 @@ const input = ref(""); const filtered = computed(() => { if (!query.value.data) return null; + return input.value === "" ? query.value.data : query.value.data.filter((entity) => { @@ -58,11 +59,11 @@ defineEmits(["change", "input"]); class="w-96 truncate p-2" :display-value="(entity) => (entity as HierarchyNode)?.label" @change=" - input = $event.target.value; $emit('input', $event.target.value); + input = $event.target.value; " /> - + diff --git a/components/facet-disclosures.vue b/components/facet-disclosures.vue index b0a62c0..63c81f0 100644 --- a/components/facet-disclosures.vue +++ b/components/facet-disclosures.vue @@ -19,10 +19,10 @@ const route = useRoute(); const facetObject: Record> = getFacetObjectFromURL(true); -const facetChange = async (facets: Array, field: string) => { +const facetChange = (facets: Array, field: string) => { facetObject[field] = facets; - await router.push({ + void router.push({ query: { ...route.query, page: 1, diff --git a/components/generic-listbox.vue b/components/generic-listbox.vue index 23270d9..0908f71 100644 --- a/components/generic-listbox.vue +++ b/components/generic-listbox.vue @@ -7,10 +7,19 @@ const model: ModelRef<{ label: string; value: string } | null> = defineModel({ default: null, }); -defineProps<{ +const props = defineProps<{ items: Array<{ label: string; value: string }>; }>(); defineEmits(["change"]); + +watch( + () => props.items, + (to) => { + console.log("items changed:", props.items, model.value); + + model.value = to[0] ? to[0] : null; + }, +);