Skip to content

Commit e7c5670

Browse files
committed
fix guard on final step
1 parent ab0a4bd commit e7c5670

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/state/guards/index.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import * as CR from 'typings'
22

33
export default {
44
hasNextStep: (context: CR.MachineContext): boolean => {
5-
const { data, position } = context
5+
const { data, position, progress } = context
66
const steps = data.stages[position.stageId].stepList
7-
const hasNext = steps[steps.length - 1] !== position.stepId
8-
console.log('GUARD: hasNextStep', hasNext)
9-
return hasNext
7+
// isn't final step yet
8+
if (steps[steps.length - 1] !== position.stepId) {
9+
return true
10+
}
11+
// final step is not yet complete
12+
return !progress.steps[position.stepId]
1013
},
1114
hasNextStage: (context: CR.MachineContext): boolean => {
1215
const { data, position } = context

0 commit comments

Comments
 (0)