From 5a72c8184bb65897ec5a21a67c4b98d83abf19f2 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Wed, 8 Jan 2020 15:34:25 -0500 Subject: [PATCH] only select filtered pledges --- src/components/Pledges.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Pledges.jsx b/src/components/Pledges.jsx index f4a2890..4a59ced 100644 --- a/src/components/Pledges.jsx +++ b/src/components/Pledges.jsx @@ -122,7 +122,7 @@ function TableRow({ pledge, amtFormatter, tokenLabel, selectedPledges, setSelect {amtFormatter(amount)} {tokenLabel} {toDecimal(id)} {getDateFromTimestamp(creationTime, true)} - + ) } @@ -147,10 +147,13 @@ function Pledges({ match }) { const amtFormatter = getHumanAmountFormatter(goalToken, currencies) const tokenLabel = getTokenLabel(goalToken, currencies) - const allSelected = selectedPledges.length === pledges.length + const filteredPledges = pledges.filter(({ pledgeState }) => pledgeTypes[pledgeState] !== PAID) + const allSelected = selectedPledges.length === filteredPledges.length const selectAll = () => { if (allSelected) return setSelected([]) - setSelected(pledges.map(p => p.id)) + setSelected( + filteredPledges.map(p => p.id) + ) } const withdrawPledges = () => { @@ -173,6 +176,7 @@ function Pledges({ match }) { openSnackBar('success', 'Funding Confirmed') setSubmitted(false) setConfirmed(true) + setSelected([]) }) .catch(e => { openSnackBar('error', 'An error has occured')