Skip to content

Commit

Permalink
fix: mf-6482 merge all lens and fids (#11912)
Browse files Browse the repository at this point in the history
* fix: mf-6481 some feeds might render empty

* fix: mf-6482 merge all lens and fids
  • Loading branch information
swkatmask authored Nov 7, 2024
1 parent a2bb7a2 commit 5050950
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
42 changes: 22 additions & 20 deletions packages/plugins/RSS3/src/SiteAdaptor/FinanceFeeds/FeedSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,28 @@ export const FeedSummary = memo<Props>(function FeedSummary({ transaction, ...re
if (['trade', 'mint'].includes(txType) && transaction.assets.length === 2) {
const inAsset = transaction.assets.find((x) => x.direction === 'receive')
const outAsset = transaction.assets.find((x) => x.direction === 'send')
return (
<>
{inAsset && outAsset ?
<SummaryTypography {...rest}>
<Trans>
<AccountLabel address={owner.address} />{' '}
<Select value={txType} _trade="traded" _mint="minted" other="traded" />{' '}
<Label>
{formatAmount(inAsset.amount)} {inAsset.symbol || inAsset.name}
</Label>{' '}
for{' '}
<Label>
{formatAmount(outAsset.amount)} {outAsset.symbol || outAsset.name}
</Label>
</Trans>
</SummaryTypography>
: null}
{approvalSummaries}
</>
)
if ((inAsset && outAsset) || approvalSummaries?.length) {
return (
<>
{inAsset && outAsset ?
<SummaryTypography {...rest}>
<Trans>
<AccountLabel address={owner.address} />{' '}
<Select value={txType} _trade="traded" _mint="minted" other="traded" />{' '}
<Label>
{formatAmount(inAsset.amount)} {inAsset.symbol || inAsset.name}
</Label>{' '}
for{' '}
<Label>
{formatAmount(outAsset.amount)} {outAsset.symbol || outAsset.name}
</Label>
</Trans>
</SummaryTypography>
: null}
{approvalSummaries}
</>
)
}
}
if (['burn', 'deposit', 'mint', 'receive', 'send', 'withdraw'].includes(txType)) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EMPTY_LIST } from '@masknet/shared-base'
import { useFireflyFarcasterAccounts, useFireflyLensAccounts } from '@masknet/web3-hooks-base'
import { FireflyConfig, FireflyFarcaster, Lens } from '@masknet/web3-providers'
import { useQuery, useInfiniteQuery, skipToken } from '@tanstack/react-query'
import { sortBy } from 'lodash-es'
import { sortBy, uniq } from 'lodash-es'
import { useCallback } from 'react'

interface Options {
Expand All @@ -17,10 +17,15 @@ export function useSocialFeeds({ userId, address }: Options) {
const { data: profiles } = useQuery({
queryKey: ['firefly', 'profiles-by-address', address],
queryFn: address ? () => FireflyConfig.getUnionProfile({ walletAddress: address }) : skipToken,
select(data) {
return {
fids: data.farcasterProfiles.map((x) => x.fid),
lensHandles: data.lensProfiles.map((x) => x.handle).concat(data.lensProfilesV3.map((x) => x.localName)),
}
},
})
const { farcasterProfiles = [], lensProfiles = [], lensProfilesV3 = [] } = profiles || {}

const fids = userId ? farAccounts.map((x) => x.id) : farcasterProfiles.map((x) => x.fid) || []
const fids = uniq(farAccounts.map((x) => x.id.toString()).concat(profiles?.fids || []))
const {
data: farcasterPosts = EMPTY_LIST,
error: farcasterError,
Expand All @@ -41,10 +46,7 @@ export function useSocialFeeds({ userId, address }: Options) {
},
})

const lensHandles =
userId ?
lensAccounts.map((x) => x.handle)
: [...lensProfiles.map((x) => x.handle), ...lensProfilesV3.map((x) => x.localName)]
const lensHandles = uniq(lensAccounts.map((x) => x.handle).concat(profiles?.lensHandles || []))
const { data: lensIds = EMPTY_LIST } = useQuery({
queryKey: ['lens', 'popup-list', lensHandles],
queryFn: async () => {
Expand Down

0 comments on commit 5050950

Please sign in to comment.