diff --git a/packages/common/src/api/purchases.ts b/packages/common/src/api/purchases.ts index 269cb847e1a..c8c70a082a4 100644 --- a/packages/common/src/api/purchases.ts +++ b/packages/common/src/api/purchases.ts @@ -76,10 +76,12 @@ const purchasesApi = createApi({ ({ contentType }) => contentType === USDCContentPurchaseType.TRACK ) .map(({ contentId }) => contentId) - await trackApiFetch.getTracksByIds( - { ids: trackIdsToFetch, currentUserId: userId }, - context - ) + if (trackIdsToFetch.length > 0) { + await trackApiFetch.getTracksByIds( + { ids: trackIdsToFetch, currentUserId: userId }, + context + ) + } return purchases }, options: { retry: true } @@ -135,10 +137,12 @@ const purchasesApi = createApi({ ({ contentType }) => contentType === USDCContentPurchaseType.TRACK ) .map(({ contentId }) => contentId) - await trackApiFetch.getTracksByIds( - { ids: trackIdsToFetch, currentUserId: userId }, - context - ) + if (trackIdsToFetch.length > 0) { + await trackApiFetch.getTracksByIds( + { ids: trackIdsToFetch, currentUserId: userId }, + context + ) + } return purchases }, options: { retry: true } diff --git a/packages/web/src/pages/pay-and-earn-page/components/PurchasesTab.tsx b/packages/web/src/pages/pay-and-earn-page/components/PurchasesTab.tsx index cdbd8003b78..6074447186f 100644 --- a/packages/web/src/pages/pay-and-earn-page/components/PurchasesTab.tsx +++ b/packages/web/src/pages/pay-and-earn-page/components/PurchasesTab.tsx @@ -107,7 +107,7 @@ export const usePurchases = () => { { userId }, - { force: true } + { disabled: !userId, force: true } ) const status = combineStatuses([dataStatus, countStatus]) diff --git a/packages/web/src/pages/pay-and-earn-page/components/SalesTab.tsx b/packages/web/src/pages/pay-and-earn-page/components/SalesTab.tsx index d1abc924250..ede7f3935f1 100644 --- a/packages/web/src/pages/pay-and-earn-page/components/SalesTab.tsx +++ b/packages/web/src/pages/pay-and-earn-page/components/SalesTab.tsx @@ -105,7 +105,7 @@ export const useSales = () => { const { status: countStatus, data: count } = useGetSalesCount( { userId }, - { force: true } + { disabled: !userId, force: true } ) const status = combineStatuses([dataStatus, countStatus]) diff --git a/packages/web/src/pages/pay-and-earn-page/components/WithdrawalsTab.tsx b/packages/web/src/pages/pay-and-earn-page/components/WithdrawalsTab.tsx index 5f5286474f2..f9441a98d3c 100644 --- a/packages/web/src/pages/pay-and-earn-page/components/WithdrawalsTab.tsx +++ b/packages/web/src/pages/pay-and-earn-page/components/WithdrawalsTab.tsx @@ -217,7 +217,7 @@ export const useWithdrawals = () => { userId, method: full.GetUSDCTransactionsMethodEnum.Send }, - { force: true } + { disabled: !userId, force: true } ) const status = combineStatuses([dataStatus, countStatus])