Skip to content

Commit

Permalink
refactor away useMembersStore (#1695)
Browse files Browse the repository at this point in the history
  • Loading branch information
asktree authored Jun 26, 2023
1 parent 043f3a8 commit 8d16894
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 324 deletions.
2 changes: 0 additions & 2 deletions components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import tokenPriceService from '@utils/services/tokenPrice'
import TransactionLoader from '@components/TransactionLoader'
import useDepositStore from 'VoteStakeRegistry/stores/useDepositStore'
import useGovernanceAssets from '@hooks/useGovernanceAssets'
import useMembers from '@components/Members/useMembers'
import useRealm from '@hooks/useRealm'
import useTreasuryAccountStore from 'stores/useTreasuryAccountStore'
import useVotePluginsClientStore from 'stores/useVotePluginsClientStore'
Expand Down Expand Up @@ -101,7 +100,6 @@ export function AppContents(props: Props) {
handleRouterHistory()
useVotingPlugins()
useHandleGovernanceAssetsStore()
useMembers()
useEffect(() => {
tokenPriceService.fetchSolanaTokenList()
}, [])
Expand Down
5 changes: 3 additions & 2 deletions components/Members/MemberOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { Member } from '@utils/uiTypes/members'
import { FC, useCallback, useEffect, useMemo, useState } from 'react'
import { WalletTokenRecordWithProposal } from './types'
import PaginationComponent from '@components/Pagination'
import useMembersStore from 'stores/useMembersStore'
import { LinkButton } from '@components/Button'
import useProgramVersion from '@hooks/useProgramVersion'
import { useRouter } from 'next/router'
Expand All @@ -49,6 +48,7 @@ import {
import useLegacyConnectionContext from '@hooks/useLegacyConnectionContext'
import { useRealmProposalsQuery } from '@hooks/queries/proposal'
import useWalletOnePointOh from '@hooks/useWalletOnePointOh'
import { useMembersQuery } from './useMembers'

const RevokeMembership: FC<{ member: PublicKey; mint: PublicKey }> = ({
member,
Expand Down Expand Up @@ -128,7 +128,7 @@ const MemberOverview = ({ member }: { member: Member }) => {
[proposalsArray]
)
const { fmtUrlWithCluster } = useQueryContext()
const activeMembers = useMembersStore((s) => s.compact.activeMembers)
const { data: activeMembers } = useMembersQuery()
const [ownVoteRecords, setOwnVoteRecords] = useState<
WalletTokenRecordWithProposal[]
>([])
Expand Down Expand Up @@ -234,6 +234,7 @@ const MemberOverview = ({ member }: { member: Member }) => {
}, [getVoteRecordsAndChatMsgs, proposalsByProposal, realm, walletAddress])

const memberVotePowerRank = useMemo(() => {
if (activeMembers === undefined) return undefined
const sortedMembers = activeMembers.sort((a, b) =>
a.communityVotes.cmp(b.communityVotes) === 1 ? -1 : 1
)
Expand Down
Loading

1 comment on commit 8d16894

@vercel
Copy link

@vercel vercel bot commented on 8d16894 Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.