Skip to content

Commit

Permalink
Fix issue not loading results for non-chained processes
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Aug 1, 2024
1 parent 1cf69ab commit 1a8e9da
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/components/Process/Chained.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,18 @@ const ChainedResultsWrapper = () => {
if (!election || election instanceof InvalidElection || loading || loaded) return
setLoading(true)
;(async () => {
const { processes: fetchedProcesses, ids } = await getAllProcessesInFlow(client, election)
for (const process of fetchedProcesses) {
setProcess(process.id, process)
try {
const { processes: fetchedProcesses, ids } = await getAllProcessesInFlow(client, election)
for (const process of fetchedProcesses) {
setProcess(process.id, process)
}
setSorted(ids)
} catch (e) {
console.error('error fetching chained processes', e)
} finally {
setLoaded(true)
setLoading(false)
}
setSorted(ids)
setLoaded(true)
setLoading(false)
})()
}, [election])

Expand Down Expand Up @@ -244,7 +249,10 @@ export const getAllProcessesInFlow = async (
}

const meta = election.get('multiprocess')
const initialIds = [election.id, ...getProcessIdsInFlowStep(meta)]
const initialIds = [election.id]
if (meta) {
initialIds.push(...getProcessIdsInFlowStep(meta))
}
for (const id of initialIds) {
await loadProcess(id)
}
Expand Down

1 comment on commit 1a8e9da

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.