Skip to content

Commit

Permalink
fix: 🐛 Fix infinit refresh bugs (#10943)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR modifies the `useUserVoteGauges` hook in the
`apps/web/src/views/GaugesVoting/hooks/useUserVoteGauges.ts` file,
focusing on the handling of the `publicClient` and the structure of the
returned data.

### Detailed summary
- Reverted the import of `publicClient` to its original form.
- Changed the `initialData` property in the query options to an empty
array.
- Updated the return statement to directly return `data` instead of
using a fallback to an empty array.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
chef-ryan authored Nov 15, 2024
1 parent 6b503e1 commit b7e013e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/web/src/views/GaugesVoting/hooks/useUserVoteGauges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useQuery } from '@tanstack/react-query'
import useAccountActiveChain from 'hooks/useAccountActiveChain'
import { useGaugesVotingContract } from 'hooks/useContract'
import { useMemo } from 'react'
import { publicClient as getPublicClient } from 'utils/viem'
import { isAddressEqual } from 'utils'
import { publicClient as getPublicClient } from 'utils/viem'
import { Hex, zeroAddress } from 'viem'
import { useVeCakeUserInfo } from 'views/CakeStaking/hooks/useVeCakeUserInfo'
import { CakePoolType } from 'views/CakeStaking/types'
Expand Down Expand Up @@ -35,7 +35,7 @@ export const useUserVoteSlopes = () => {
userInfo?.cakePoolProxy,
publicClient,
],

initialData: [],
queryFn: async (): Promise<VoteSlope[]> => {
if (!gauges || gauges.length === 0 || !account || !publicClient) return []

Expand Down Expand Up @@ -88,7 +88,7 @@ export const useUserVoteSlopes = () => {
})

return {
data: data ?? [],
data,
refetch,
isLoading,
}
Expand Down

0 comments on commit b7e013e

Please sign in to comment.