Skip to content

Commit 1a8e9da

Browse files
committed
Fix issue not loading results for non-chained processes
1 parent 1cf69ab commit 1a8e9da

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/components/Process/Chained.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,18 @@ const ChainedResultsWrapper = () => {
135135
if (!election || election instanceof InvalidElection || loading || loaded) return
136136
setLoading(true)
137137
;(async () => {
138-
const { processes: fetchedProcesses, ids } = await getAllProcessesInFlow(client, election)
139-
for (const process of fetchedProcesses) {
140-
setProcess(process.id, process)
138+
try {
139+
const { processes: fetchedProcesses, ids } = await getAllProcessesInFlow(client, election)
140+
for (const process of fetchedProcesses) {
141+
setProcess(process.id, process)
142+
}
143+
setSorted(ids)
144+
} catch (e) {
145+
console.error('error fetching chained processes', e)
146+
} finally {
147+
setLoaded(true)
148+
setLoading(false)
141149
}
142-
setSorted(ids)
143-
setLoaded(true)
144-
setLoading(false)
145150
})()
146151
}, [election])
147152

@@ -244,7 +249,10 @@ export const getAllProcessesInFlow = async (
244249
}
245250

246251
const meta = election.get('multiprocess')
247-
const initialIds = [election.id, ...getProcessIdsInFlowStep(meta)]
252+
const initialIds = [election.id]
253+
if (meta) {
254+
initialIds.push(...getProcessIdsInFlowStep(meta))
255+
}
248256
for (const id of initialIds) {
249257
await loadProcess(id)
250258
}

0 commit comments

Comments
 (0)