diff --git a/apps/shelter-web/src/app/shared/components/address/addressSuggestion.tsx b/apps/shelter-web/src/app/shared/components/address/addressSuggestion.tsx index 7467865c6..dd4c5f77f 100644 --- a/apps/shelter-web/src/app/shared/components/address/addressSuggestion.tsx +++ b/apps/shelter-web/src/app/shared/components/address/addressSuggestion.tsx @@ -11,13 +11,14 @@ export function AddressSuggestion(props: TAddressOption) { const { description, - structured_formatting: { main_text, secondary_text }, + structured_formatting: { main_text = '', secondary_text = '' }, } = item; let primaryText = main_text; + const secondaryText = secondary_text.replace(/, USA$/, ''); - if (!secondaryText) { + if (!secondaryText && description) { primaryText = description; } @@ -35,6 +36,10 @@ export function AddressSuggestion(props: TAddressOption) { 'active:bg-neutral-98', ].join(' '); + if (!primaryText) { + return null; + } + return (