Skip to content

Commit

Permalink
Miscellaneous data fetching fixes for Pay and Earn page (#7493)
Browse files Browse the repository at this point in the history
  • Loading branch information
schottra authored Feb 7, 2024
1 parent ffd3a6f commit a202295
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
20 changes: 12 additions & 8 deletions packages/common/src/api/purchases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const usePurchases = () => {
{
userId
},
{ force: true }
{ disabled: !userId, force: true }
)

const status = combineStatuses([dataStatus, countStatus])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const useWithdrawals = () => {
userId,
method: full.GetUSDCTransactionsMethodEnum.Send
},
{ force: true }
{ disabled: !userId, force: true }
)

const status = combineStatuses([dataStatus, countStatus])
Expand Down

0 comments on commit a202295

Please sign in to comment.