fix(useSWR): request hooks revalidation on focus disabled (#340)
This commit is contained in:
parent
cec9e50955
commit
c25d8607e8
@ -5,5 +5,6 @@ import getAccount from 'api/accounts/getAccount'
|
||||
export default function useAccounts(accountId?: string) {
|
||||
return useSWR(`account${accountId}`, () => getAccount(accountId || ''), {
|
||||
refreshInterval: 30000,
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -6,5 +6,6 @@ export default function useAccounts(address?: string) {
|
||||
return useSWR(`accounts${address}`, () => getAccounts(address || ''), {
|
||||
suspense: true,
|
||||
isPaused: () => !address,
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -3,5 +3,7 @@ import useSWR from 'swr'
|
||||
import calculateAssetIncentivesApy from 'api/incentives/calculateAssetIncentivesApy'
|
||||
|
||||
export default function useAssetIncentivesApy(denom: string) {
|
||||
return useSWR(`assetIncentiveApy-${denom}`, () => calculateAssetIncentivesApy(denom))
|
||||
return useSWR(`assetIncentiveApy-${denom}`, () => calculateAssetIncentivesApy(denom), {
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -5,5 +5,6 @@ import getAssetParams from 'api/params/getAssetParams'
|
||||
export default function useAssetParams() {
|
||||
return useSWR('assetParams', getAssetParams, {
|
||||
fallbackData: [],
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -5,5 +5,6 @@ import getDepositedVaults from 'api/vaults/getDepositedVaults'
|
||||
export default function useDepositedVaults(accountId: string) {
|
||||
return useSWR(`depositedVaultsByAccount-${accountId}`, () => getDepositedVaults(accountId), {
|
||||
suspense: true,
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -6,5 +6,6 @@ export default function useMarketAssets() {
|
||||
return useSWR(`marketAssets`, getMarkets, {
|
||||
suspense: true,
|
||||
fallbackData: [],
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -6,5 +6,6 @@ export default function useMarketBorrowings() {
|
||||
return useSWR(`marketBorrowings`, getMarketBorrowings, {
|
||||
fallbackData: [],
|
||||
suspense: false,
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -6,5 +6,6 @@ export default function useMarketDeposits() {
|
||||
return useSWR(`marketDeposits`, getMarketDeposits, {
|
||||
suspense: true,
|
||||
fallbackData: [],
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -6,5 +6,6 @@ export default function useMarketLiquidities() {
|
||||
return useSWR(`marketLiquidities`, getMarketLiquidities, {
|
||||
suspense: true,
|
||||
fallbackData: [],
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -6,5 +6,6 @@ export default function usePrices() {
|
||||
return useSWR('prices', getPrices, {
|
||||
fallbackData: [],
|
||||
refreshInterval: 30000,
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -5,5 +5,6 @@ import getSwapRoute from 'api/swap/getSwapRoute'
|
||||
export default function useSwapRoute(denomIn: string, denomOut: string) {
|
||||
return useSWR(`swapRoute-${denomIn}-${denomOut}`, () => getSwapRoute(denomIn, denomOut), {
|
||||
fallbackData: [],
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -5,5 +5,6 @@ import { getVaultConfigs } from 'api/vaults/getVaultConfigs'
|
||||
export default function useVaultConfigs() {
|
||||
return useSWR('vaultConfigs', getVaultConfigs, {
|
||||
fallbackData: [],
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
@ -5,5 +5,6 @@ import getVaults from 'api/vaults/getVaults'
|
||||
export default function useVaults(address?: string) {
|
||||
return useSWR(`vaults${address}`, () => getVaults(), {
|
||||
suspense: true,
|
||||
revalidateOnFocus: false,
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user