Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

feat: enhance Usernames component to filter usernames by current account address and handle loading state

yoginth.com 4147e9a3 0a3056e1

verified
+10 -3
+10 -3
apps/web/src/components/ENS/Usernames.tsx
··· 1 1 import { HEY_ENS_NAMESPACE } from "@hey/data/constants"; 2 2 import { useUsernamesQuery } from "@hey/indexer"; 3 3 import { Card, Image } from "@/components/Shared/UI"; 4 + import { useAccountStore } from "@/store/persisted/useAccountStore"; 4 5 5 6 const Usernames = () => { 6 - const { data } = useUsernamesQuery({ 7 - variables: { request: { filter: { namespace: HEY_ENS_NAMESPACE } } } 7 + const { currentAccount } = useAccountStore(); 8 + 9 + const { data, loading } = useUsernamesQuery({ 10 + variables: { 11 + request: { 12 + filter: { namespace: HEY_ENS_NAMESPACE, owner: currentAccount?.address } 13 + } 14 + } 8 15 }); 9 16 10 17 const usernames = data?.usernames?.items; 11 18 12 - if (usernames?.length === 0) { 19 + if (loading || usernames?.length === 0) { 13 20 return null; 14 21 } 15 22