A decentralized music tracking and discovery platform built on AT Protocol 🎵

Use stateful date range for artists query

Introduce a range state that's passed into useArtistsQuery. Clear the
range when the query returns no artists to avoid passing date arguments.

+7 -1
+7 -1
apps/web/src/pages/profile/Profile.tsx
··· 61 61 const profile = useProfileByDidQuery(did!); 62 62 const setUser = useSetAtom(userAtom); 63 63 const { tab } = useSearch({ strict: false }); 64 - const { data: artists } = useArtistsQuery(did!, 0, 100, ...getLastDays(7)); 64 + const [range, setRange] = useState<[Date, Date] | []>(getLastDays(7)); 65 + const { data: artists } = useArtistsQuery(did!, 0, 100, ...range); 65 66 const { mutate: followAccount } = useFollowAccountMutation(); 66 67 const { mutate: unfollowAccount } = useUnfollowAccountMutation(); 67 68 const currentDid = localStorage.getItem("did"); ··· 74 75 if (!artists) { 75 76 return []; 76 77 } 78 + 79 + if (artists.length === 0) { 80 + setRange([]); 81 + } 82 + 77 83 return Array.from( 78 84 new Set( 79 85 artists