Skip to content

Commit

Permalink
Merge pull request #3863 from hirosystems/fix/stamps-query
Browse files Browse the repository at this point in the history
fix: early return if stamps query returns undefined
  • Loading branch information
fbwoolf authored Jun 13, 2023
2 parents dcc9ec4 + 9378be5 commit 2017a74
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/features/collectibles/components/bitcoin/stamps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { Stamp } from './stamp';

export function Stamps() {
const currentAccountBtcAddress = useCurrentAccountNativeSegwitAddressIndexZero();
const { data: stamps } = useStampsByAddressQuery(currentAccountBtcAddress);
const { data: stamps = [] } = useStampsByAddressQuery(currentAccountBtcAddress);
const analytics = useAnalytics();

useEffect(() => {
if (!stamps) return;
if (!stamps.length) return;
if (stamps.length > 0) {
void analytics.track('view_collectibles', {
stamps_count: stamps.length,
Expand All @@ -21,7 +21,7 @@ export function Stamps() {
}
}, [analytics, stamps]);

if (!stamps) return null;
if (!stamps.length) return null;

return (
<>
Expand Down

0 comments on commit 2017a74

Please sign in to comment.