Skip to content

Commit

Permalink
slight change to useL2ProposalsState
Browse files Browse the repository at this point in the history
  • Loading branch information
wildmolasses committed Nov 17, 2023
1 parent 5e94096 commit 10ca387
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions hooks/useProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ const useL2ProposalsState = (l2Proposals?: { proposalId: string; startBlock: str
};
}),
});
const data = proposalState?.map((proposal, i) => {
return {
...proposal,
i,
};
});

return {
data,
data: l2Proposals?.map((proposal, i) => {
return {
proposalId: proposal.proposalId,
state: proposalState?.[i].result,
};
}),
isLoading,
error,
};
Expand Down Expand Up @@ -245,14 +245,17 @@ export const useProposals = () => {
const l2Proposal = l2Proposals?.find(
(l2Proposal) => l2Proposal.proposalId === proposal.proposalId
);
const l2ProposalState = l2ProposalsState?.find(
(l2ProposalState) => proposal.proposalId === l2ProposalState.proposalId
)?.state;
const l1ProposalStatus = proposal.isCancelled
? 'cancelled'
: l1Block && l1Block > BigInt(proposal.endBlock)
? 'closed'
: 'open';
const l2ProposalStatus =
!l2Proposal?.isCancelled && l2ProposalsState?.length && l2ProposalsState[i]
? statusLabel(l2ProposalsState[i]?.result as number)
!l2Proposal?.isCancelled && l2ProposalsState?.length && l2ProposalState
? statusLabel(l2ProposalState as number)
: 'closed';
return {
id: proposal.proposalId,
Expand Down

0 comments on commit 10ca387

Please sign in to comment.