good morning!!!!

Skip to content
Snippets Groups Projects
Commit f7989f2c authored by Shenqi Hu's avatar Shenqi Hu Committed by Jake Johnston
Browse files

increase refetch interval

parent 6aaba872
Branches
Tags
No related merge requests found
...@@ -17,10 +17,9 @@ export const ChainDataContextProvider = ({ children }: { children: React.ReactEl ...@@ -17,10 +17,9 @@ export const ChainDataContextProvider = ({ children }: { children: React.ReactEl
const [gasPrice, setGasPrice] = useState('0') const [gasPrice, setGasPrice] = useState('0')
const { const {
data: opData, data: opData,
refetch, refetch
isError: opDataError,
} = useQuery({ } = useQuery({
refetchInterval: 5000, refetchInterval: 15000,
queryKey: ['op block'], queryKey: ['op block'],
queryFn: async () => { queryFn: async () => {
const block = await provider?.getBlockNumber() const block = await provider?.getBlockNumber()
...@@ -28,8 +27,11 @@ export const ChainDataContextProvider = ({ children }: { children: React.ReactEl ...@@ -28,8 +27,11 @@ export const ChainDataContextProvider = ({ children }: { children: React.ReactEl
}, },
enabled: chainId !== ChainIDs.MAINNET, enabled: chainId !== ChainIDs.MAINNET,
}) })
const { data: ethData, isError: ethDataError } = useQuery({ const { data: ethData } = useQuery({
refetchInterval: 5000, refetchInterval: () => {
if (chainId === ChainIDs.MAINNET) return 15 * 1000
return 60 * 1000
},
queryKey: ['eth block'], queryKey: ['eth block'],
queryFn: async () => { queryFn: async () => {
const ans = await ethProvider?.getBlockNumber() const ans = await ethProvider?.getBlockNumber()
...@@ -37,7 +39,7 @@ export const ChainDataContextProvider = ({ children }: { children: React.ReactEl ...@@ -37,7 +39,7 @@ export const ChainDataContextProvider = ({ children }: { children: React.ReactEl
}, },
}) })
const { data: gas, isError: gasError } = useQuery({ const { data: gas, isError: gasError } = useQuery({
refetchInterval: 5000, refetchInterval: 15000,
queryKey: ['gas'], queryKey: ['gas'],
queryFn: async () => { queryFn: async () => {
const block = await getGasPrice(provider!) const block = await getGasPrice(provider!)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment