Skip to content

Commit

Permalink
fix: Fix crash with favorite lists (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
devcshort authored Oct 24, 2024
1 parent a412478 commit d40aaed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/features/favorites/components/favorite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ export function Favorite({
const address = data.addresses.find(
(el) => el.rank === 1 && el.type === 'physical',
);
const displayAddress = `${address.address_1}, ${address.city}, ${address.stateProvince} ${address.postalCode}`;
const displayAddress = !(
address?.address_1 &&
address?.city &&
address?.stateProvince &&
address?.postalCode
)
? ''
: `${address.address_1}, ${address.city}, ${address.stateProvince} ${address.postalCode}`;

return (
<Card>
Expand Down

0 comments on commit d40aaed

Please sign in to comment.