diff --git a/lib/hooks/queries/useAccountTokenPositions.ts b/lib/hooks/queries/useAccountTokenPositions.ts index 973b43466..7767102bc 100644 --- a/lib/hooks/queries/useAccountTokenPositions.ts +++ b/lib/hooks/queries/useAccountTokenPositions.ts @@ -28,6 +28,7 @@ export const useAccountTokenPositions = (address?: string) => { keepPreviousData: true, enabled: Boolean(sdk && isIndexedSdk(sdk) && address), refetchInterval: 12 * 1000, + staleTime: Infinity, }, ); }; diff --git a/lib/hooks/queries/useAvatarParts.ts b/lib/hooks/queries/useAvatarParts.ts index f3a83c17e..6b31df667 100644 --- a/lib/hooks/queries/useAvatarParts.ts +++ b/lib/hooks/queries/useAvatarParts.ts @@ -22,6 +22,7 @@ export const useAvatarParts = ( { enabled, keepPreviousData: true, + staleTime: 100_000, }, ); }; diff --git a/lib/hooks/queries/useCategoryCounts.ts b/lib/hooks/queries/useCategoryCounts.ts index 4f9e9af32..f60e2cfb2 100644 --- a/lib/hooks/queries/useCategoryCounts.ts +++ b/lib/hooks/queries/useCategoryCounts.ts @@ -24,6 +24,7 @@ export const useCategoryCounts = () => { { enabled: Boolean(sdk && isIndexedSdk(sdk)), keepPreviousData: true, + staleTime: 100_000, }, ); diff --git a/lib/hooks/queries/useFeePayingAsset.ts b/lib/hooks/queries/useFeePayingAsset.ts index 1382408f7..34fd6830e 100644 --- a/lib/hooks/queries/useFeePayingAsset.ts +++ b/lib/hooks/queries/useFeePayingAsset.ts @@ -43,8 +43,7 @@ export const useFeePayingAsset = ( const query = useQuery( [ feePayingAssetKey, - activeAccount, - activeAccount, + activeAccount?.address, nativeBalance, dotBalance, baseFee, diff --git a/lib/hooks/queries/useIdentity.ts b/lib/hooks/queries/useIdentity.ts index 1e59e5c8b..4915f9671 100644 --- a/lib/hooks/queries/useIdentity.ts +++ b/lib/hooks/queries/useIdentity.ts @@ -65,6 +65,7 @@ export const useIdentity = (address?: string) => { }, { enabled: Boolean(sdk && isRpcSdk(sdk)), + staleTime: 100_000, }, ); diff --git a/lib/hooks/queries/useInfiniteMarkets.ts b/lib/hooks/queries/useInfiniteMarkets.ts index ca6766056..fbeb82082 100644 --- a/lib/hooks/queries/useInfiniteMarkets.ts +++ b/lib/hooks/queries/useInfiniteMarkets.ts @@ -125,6 +125,7 @@ export const useInfiniteMarkets = ( ); }); }, + staleTime: 10_000, }); return query; }; diff --git a/lib/hooks/queries/useMarket.ts b/lib/hooks/queries/useMarket.ts index 22bbf4492..f007411f7 100644 --- a/lib/hooks/queries/useMarket.ts +++ b/lib/hooks/queries/useMarket.ts @@ -31,6 +31,7 @@ export const useMarket = ( }, { refetchInterval: opts?.refetchInterval ?? false, + staleTime: 10_000, enabled: Boolean( sdk && isIndexedSdk(sdk) && @@ -74,6 +75,7 @@ const batcher = memoize((sdk: Sdk) => { }); return markets; }, + scheduler: batshit.windowScheduler(10), resolver: (data, query) => { if ("marketId" in query) { diff --git a/lib/hooks/queries/useMarketDisputes.ts b/lib/hooks/queries/useMarketDisputes.ts index c39b7ea12..2ae238e78 100644 --- a/lib/hooks/queries/useMarketDisputes.ts +++ b/lib/hooks/queries/useMarketDisputes.ts @@ -18,6 +18,7 @@ export const useMarketDisputes = (market: Market | number) => { }, { enabled: Boolean(sdk && isRpcSdk(sdk)), + staleTime: 100_000, }, ); return query; diff --git a/lib/hooks/queries/useMarketEventHistory.ts b/lib/hooks/queries/useMarketEventHistory.ts index 9336313dd..dfde6456e 100644 --- a/lib/hooks/queries/useMarketEventHistory.ts +++ b/lib/hooks/queries/useMarketEventHistory.ts @@ -5,7 +5,7 @@ import { MarketEvent } from "lib/gql/market-history"; import { useMarket } from "./useMarket"; import { getMarketHistory } from "lib/gql/market-history"; -export const marketsEventsRootQuery = "marketsEvents"; +export const marketsEventsRootQuery = "market-events"; export type MarketEventHistory = { start: MarketEvent; @@ -63,6 +63,7 @@ export const useMarketEventHistory = ( }, { enabled: Boolean(sdk && isIndexedSdk(sdk) && isRpcSdk(sdk) && market), + staleTime: 10_000, }, ); }; diff --git a/lib/hooks/queries/useMarketPriceHistory.ts b/lib/hooks/queries/useMarketPriceHistory.ts index 1fdbf41ba..beb0c49e1 100644 --- a/lib/hooks/queries/useMarketPriceHistory.ts +++ b/lib/hooks/queries/useMarketPriceHistory.ts @@ -4,7 +4,7 @@ import { TimeUnit } from "components/ui/TimeFilters"; import { gql, GraphQLClient } from "graphql-request"; import { useSdkv2 } from "../useSdkv2"; -export const marketPriceHistoryKey = "market-price-histroy"; +export const marketPriceHistoryKey = "market-price-history"; const priceHistoryQuery = gql` query PriceHistory( @@ -56,6 +56,7 @@ export const useMarketPriceHistory = ( enabled: Boolean( sdk && marketId != null && timeUnit && timeValue && startTime, ), + staleTime: 10_000, }, ); diff --git a/lib/hooks/queries/useMarketStage.ts b/lib/hooks/queries/useMarketStage.ts index 156fb03bf..d57f4dc1d 100644 --- a/lib/hooks/queries/useMarketStage.ts +++ b/lib/hooks/queries/useMarketStage.ts @@ -27,6 +27,7 @@ export const useMarketStage = (market?: Market) => { }, { enabled: Boolean(sdk && isRpcSdk(sdk) && market && now), + staleTime: 10_000, }, ); }; diff --git a/lib/hooks/queries/useMarketsStats.ts b/lib/hooks/queries/useMarketsStats.ts index c1dbdcc89..2cbfd1927 100644 --- a/lib/hooks/queries/useMarketsStats.ts +++ b/lib/hooks/queries/useMarketsStats.ts @@ -3,7 +3,7 @@ import { isIndexedSdk } from "@zeitgeistpm/sdk-next"; import { getMarketsStats, MarketStats } from "lib/gql/markets-stats"; import { useSdkv2 } from "../useSdkv2"; -export const marketsStatsRootQuery = "marketsStats"; +export const marketsStatsRootQuery = "markets-stats"; export const useMarketsStats = ( marketIds: number[], @@ -21,6 +21,7 @@ export const useMarketsStats = ( { enabled: sdk != null && isIndexedSdk(sdk) && marketIds.length > 0, keepPreviousData: true, + staleTime: 100_000, }, ); }; diff --git a/lib/hooks/queries/usePool.ts b/lib/hooks/queries/usePool.ts index 4db4276af..3cfa51eed 100644 --- a/lib/hooks/queries/usePool.ts +++ b/lib/hooks/queries/usePool.ts @@ -17,6 +17,7 @@ export const usePool = (getPoolQuery?: PoolGetQuery) => { }, { enabled: Boolean(sdk && getPoolQuery && isIndexedSdk(sdk)), + staleTime: 10_000, }, ); diff --git a/lib/hooks/queries/useReadyToReportMarkets.ts b/lib/hooks/queries/useReadyToReportMarkets.ts index 01228fa97..c1efa3578 100644 --- a/lib/hooks/queries/useReadyToReportMarkets.ts +++ b/lib/hooks/queries/useReadyToReportMarkets.ts @@ -43,6 +43,7 @@ export const useReadyToReportMarkets = (account?: string) => { { enabled: Boolean(enabled), refetchInterval: 1000 * 60, + staleTime: Infinity, }, ); }; diff --git a/lib/hooks/queries/useRedeemableMarkets.ts b/lib/hooks/queries/useRedeemableMarkets.ts index 1f053da72..f1f374d09 100644 --- a/lib/hooks/queries/useRedeemableMarkets.ts +++ b/lib/hooks/queries/useRedeemableMarkets.ts @@ -76,6 +76,7 @@ export const useRedeemableMarkets = (account?: string) => { }, { enabled: Boolean(enabled), + staleTime: 100_000, }, ); }; diff --git a/lib/hooks/queries/useSimilarMarkets.ts b/lib/hooks/queries/useSimilarMarkets.ts index 22b45d588..42ed753af 100644 --- a/lib/hooks/queries/useSimilarMarkets.ts +++ b/lib/hooks/queries/useSimilarMarkets.ts @@ -60,6 +60,7 @@ export const useSimilarMarkets = (marketId?: number, limit = 2) => { }, { enabled: Boolean(enabled), + staleTime: Infinity, }, );