Skip to content

Commit c33691e

Browse files
committed
Fix null
1 parent 8fc54f9 commit c33691e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/chakra-components/src/components/Election/Questions/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const QuestionsFormProvider: React.FC<
4343
return (
4444
<FormProvider {...fmethods}>
4545
<QuestionsFormContext.Provider
46-
value={{ fmethods, renderWith: props.renderWith, validate: props.validate, ...multiElections }}
46+
value={{ fmethods, renderWith: props.renderWith ?? [], validate: props.validate, ...multiElections }}
4747
>
4848
{children}
4949
</QuestionsFormContext.Provider>

packages/chakra-components/src/components/Election/Questions/Questions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const ElectionQuestionsForm = ({ formId, onSubmit, onInvalid, ...rest }:
7373
<chakra.div __css={styles.elections}>
7474
<MultiElectionVoted />
7575
<ElectionQuestion isDisabled={isDisabled} {...rest} />
76-
{renderWith?.length > 0 &&
76+
{renderWith?.length &&
7777
renderWith.map(({ id }) => (
7878
<ElectionProvider key={id} ConnectButton={ConnectButton} id={id} fetchCensus>
7979
<SubElectionQuestions {...rest} />

packages/chakra-components/src/components/Election/Questions/Voted.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export const MultiElectionVoted = () => {
1111
if (!voted) {
1212
return null
1313
}
14-
const votes = Object.values(elections).map((e) => e.voted)
14+
const votes = Object.values(elections)
15+
.map((e) => e.voted)
16+
.filter((voted) => voted !== null)
1517
return <VotedLogic votes={votes} />
1618
}
1719

0 commit comments

Comments
 (0)