Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/common/src/api/tan-query/coins/useFanClubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ export const useFanClubs = <TData = Coin[]>(
// Otherwise, return the next offset
return allPages.length * pageSize
},
enabled: options?.enabled !== false,
select: options?.select ?? ((data) => data.pages.flat() as TData),
...options
...options,
enabled: options?.enabled !== false
})
}

Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/api/tan-query/coins/useWalletCoins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const useWalletCoins = <TResult = UserCoin[]>(
}
return []
},
enabled: options?.enabled !== false && !!params.walletAddress,
...options
...options,
enabled: options?.enabled !== false && !!params.walletAddress
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const useUserRemixContests = (
.filter(removeNullable)
},
select: (data) => data.pages.flat(),
enabled: options?.enabled !== false && !!userId,
...options
...options,
enabled: options?.enabled !== false && !!userId
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ export const useCoinExchangeRate = (
)
}
},
enabled: !!params.inputMint && !!params.outputMint,
...options
...options,
enabled:
!!params.inputMint && !!params.outputMint && options?.enabled !== false
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export const usePlaylistUpdates = <TResult = PlaylistUpdate[]>(
playlistUpdateFromSDK
)
},
enabled: !!currentUserId,
refetchInterval: PLAYLIST_UPDATES_POLLING_FREQ_MS,
refetchOnWindowFocus: true,
...options
...options,
enabled: !!currentUserId && options?.enabled !== false
})
}

Expand Down
8 changes: 4 additions & 4 deletions packages/common/src/api/tan-query/remixes/useRemixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export const useRemixes = (
type: EntityType.TRACK
}))
},
enabled: options?.enabled !== false && !!trackId,
...options
...options,
enabled: options?.enabled !== false && !!trackId
})

return queryData
Expand Down Expand Up @@ -198,7 +198,7 @@ export const useRemixesCount = (
dispatch(remixesPageActions.setCount({ count }))
return count
},
enabled: options?.enabled !== false && !!trackId,
...options
...options,
enabled: options?.enabled !== false && !!trackId
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const useCurrentAccount = <TResult = AccountState | null | undefined>(
getLocalAccountPlaceholder(localStorage, queryClient),
staleTime: Infinity,
gcTime: Infinity,
enabled: options?.enabled !== false && !!currentUserWallet,
...options
...options,
enabled: options?.enabled !== false && !!currentUserWallet
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const useManagers = <TResult = UserManagerMetadata[] | undefined>(
const data = rawData.filter((g: any) => g.grant.isApproved !== false)
return userManagerListFromSDK(data) as TResult
},
enabled: isValidId(userId),
...options
...options,
enabled: isValidId(userId) && options?.enabled !== false
})
}
4 changes: 2 additions & 2 deletions packages/common/src/api/tan-query/wallets/useCoinBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export const useCoinBalance = ({
includeStaked
},
{
enabled: isAudio,
refetchInterval: isPolling ? pollingInterval : undefined,
refetchOnWindowFocus: !isPolling,
...queryOptions
...queryOptions,
enabled: isAudio && queryOptions.enabled !== false
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export const useDestinationUsdcAccountCheck = (

return { hasUsdcAccount: false, ataCreationFeeUsdc }
},
enabled: isValidAddress && options?.enabled !== false,
staleTime: 60_000,
...options
...options,
enabled: isValidAddress && options?.enabled !== false
})
}
4 changes: 2 additions & 2 deletions packages/common/src/api/tan-query/wallets/useUSDCBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ export const useUSDCBalance = <TResult = UsdcWei | null>({
throw e
}
},
enabled: !!ethAddress,
// TanStack Query's built-in polling - only poll when isPolling is true
refetchInterval: isPolling ? pollingInterval : false,
// Prevent refetching when window regains focus during polling to avoid conflicts
refetchOnWindowFocus: !isPolling,
...queryOptions
...queryOptions,
enabled: !!ethAddress && queryOptions.enabled !== false
})

// Map TanStack Query states to the Status enum for API compatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const useUserBalanceHistory = <TResult = BalanceHistoryDataPoint[]>(
})) ?? []
)
},
enabled: options?.enabled !== false && !!params.userId,
...options
...options,
enabled: options?.enabled !== false && !!params.userId
})
}
2 changes: 1 addition & 1 deletion packages/common/src/hooks/useMintRecovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export const useMintRecovery = (
return BigInt(0)
}
},
enabled: options?.enabled !== false && !!mint,
refetchInterval: 2000, // Poll every 2 seconds
refetchOnWindowFocus: true,
...options,
enabled: options?.enabled !== false && !!mint,
select: (balance: bigint) => {
// If there's a balance, trigger recovery
if (balance > BigInt(0)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/hooks/useUserbank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export const useUserbank = (
})
return accountInfo.toString()
},
enabled: options?.enabled !== false && !!mint && !!wallet,
...options
...options,
enabled: options?.enabled !== false && !!mint && !!wallet
})

return {
Expand Down
Loading