Skip to content

Commit 06448b3

Browse files
committed
fix: deduplicate lite DAO cards when full DAO exists
Filter out lite DAOs from the explorer list when they have a daoContract field matching a full (on-chain) DAO address, since the full DAO page already shows off-chain polls.
1 parent 9098f70 commit 06448b3

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/services/services/dao/hooks/useAllDAOs.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ export const useAllDAOs = (network: Network) => {
6565
lite_daos = []
6666
}
6767

68-
return [...homebase_daos, ...lite_daos]
68+
// Filter out lite DAOs that already have a corresponding full (on-chain) DAO,
69+
// since the full DAO page already displays their off-chain polls.
70+
const fullDaoAddresses = new Set(homebase_daos.map((dao: any) => dao.address))
71+
const dedupedLiteDaos = lite_daos.filter((dao: any) => !dao.daoContract || !fullDaoAddresses.has(dao.daoContract))
72+
73+
return [...homebase_daos, ...dedupedLiteDaos]
6974
},
7075
{
7176
// Always create the hook; let the fetcher short-circuit for Etherlink networks.

src/services/services/lite/lite-services.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export const getLiteDAOs = async (network: string) => {
6868
},
6969
votingAddressesCount: dao.votingAddressesCount,
7070
allowPublicAccess: dao.allowPublicAccess,
71+
daoContract: dao.daoContract,
7172
ledgers: dao.members.map(member => {
7273
return {
7374
holder: {

src/services/services/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export interface DAOListItem {
203203
token: TokenDTO
204204
votingAddressesCount: number
205205
allowPublicAccess: boolean
206+
daoContract?: string
206207
}
207208

208209
export type FetchedDAO = DAODTO & {
@@ -251,4 +252,5 @@ export interface Community {
251252
decimals: string
252253
network: Network
253254
votingAddressesCount: number
255+
daoContract?: string
254256
}

0 commit comments

Comments
 (0)