Skip to content

Commit

Permalink
include all changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanlesich committed Oct 31, 2023
1 parent c1772c4 commit 7dd9cd2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
5 changes: 5 additions & 0 deletions apps/web/src/data/subgraph/requests/dashboardQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ export const dashboardRequest = async (memberAddress: string) => {
console.error(e)
Sentry.captureException(e)
await Sentry.flush(2000)
throw new Error(
e?.message
? `Goldsky Request Error: ${e.message}`
: 'Error fetching dashboard data from Goldsky subgraph.'
)
}
}
43 changes: 26 additions & 17 deletions apps/web/src/modules/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,29 @@ export type DashboardDaoProps = DaoFragment & {
}

const fetchDaoProposalState = async (dao: DashboardDaoProps) => {
const proposals = await Promise.all(
dao.proposals.map(async (proposal) => {
const proposalState = await getProposalState(
dao.chainId,
proposal.dao.governorAddress,
proposal.proposalId
)
return { ...proposal, proposalState: proposalState }
})
)
return {
...dao,
proposals: proposals.filter((proposal) =>
ACTIVE_PROPOSAL_STATES.includes(proposal.proposalState)
),
try {
const proposals = await Promise.all(
dao.proposals.map(async (proposal) => {
const proposalState = await getProposalState(
dao.chainId,
proposal.dao.governorAddress,
proposal.proposalId
)
return { ...proposal, proposalState: proposalState }
})
)
return {
...dao,
proposals: proposals.filter((proposal) =>
ACTIVE_PROPOSAL_STATES.includes(proposal.proposalState)
),
}
} catch (error: any) {
throw new Error(
error?.message
? `RPC Error: ${error.message}`
: 'Error fetch Dashboard data from RPC'
)
}
}

Expand All @@ -70,9 +78,10 @@ const fetchDashboardData = async (address: string) => {
const userDaos = (await dashboardRequest(address)) as unknown as DashboardDaoProps[]
if (!userDaos) throw new Error('Dashboard DAO query returned undefined')
const resolved = await Promise.all(userDaos.map(fetchDaoProposalState))

return resolved
} catch (error) {
throw new Error('Error fetching dashboard data')
} catch (error: any) {
throw new Error(error?.message || 'Error fetching dashboard data')
}
}

Expand Down

0 comments on commit 7dd9cd2

Please sign in to comment.