Skip to content

Commit

Permalink
fix: update Street address empty status properly
Browse files Browse the repository at this point in the history
  • Loading branch information
fterra-encora committed Oct 4, 2023
1 parent 42c8e9e commit d04dbe8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/src/components/forms/AutoCompleteInputComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ let selectedValue: BusinessSearchResult | undefined = undefined;
//This function emits the events on update
const emitValueChange = (newValue: string): void => {
selectedValue = inputList.value.find((entry) => entry.code === newValue);
// Prevent selecting the empty value provided when props.contents is empty.
selectedValue = newValue ? inputList.value.find((entry) => entry.code === newValue) : undefined;
emit("update:model-value", selectedValue?.name ?? newValue);
emit("update:selected-value", selectedValue);
emit("empty", isEmpty(selectedValue));
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/grouping/AddressGroupComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const detailsData = ref<Address | null>(null);
watch([autoCompleteResult], () => {
addressControl.value = false;
if (autoCompleteResult.value) {
if (autoCompleteResult.value && autoCompleteResult.value.code) {
showDetailsLoading.value = true;
const { error, loading: detailsLoading } = useFetchTo(
`/api/clients/addresses/${encodeURIComponent(
Expand Down

0 comments on commit d04dbe8

Please sign in to comment.