Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit11eae22

Browse files
committed
fix issue with startup progress
1 parent814f633 commit11eae22

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

‎src/state/actions/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,16 @@ export default {
8383
if(!currentTutorial){
8484
thrownewError('No Tutorial loaded')
8585
}
86+
8687
const{ data}=currentTutorial
87-
constlevelId=data.summary.levelList.find((id:string)=>!currentProgress.levels[id])
88-
if(!levelId){
89-
thrownewError('No level found on position load')
90-
}
91-
conststageId=data.levels[levelId].stageList.find((id:string)=>!currentProgress.stages[id])
92-
if(!stageId){
93-
thrownewError('No stage found on position load')
94-
}
95-
conststepId=data.stages[stageId].stepList.find((id:string)=>!currentProgress.steps[id])
96-
if(!stepId){
97-
thrownewError('No step found on position load')
98-
}
88+
89+
const{ levelList}=data.summary
90+
// take next incomplete level or the final step
91+
constlevelId=levelList.find((id:string)=>!currentProgress.levels[id])||levelList[levelList.length-1]
92+
const{ stageList}=data.levels[levelId]
93+
conststageId=stageList.find((id:string)=>!currentProgress.stages[id])||stageList[stageList.length-1]
94+
const{ stepList}=data.stages[stageId]
95+
conststepId=stepList.find((id:string)=>!currentProgress.steps[id])||stepList[stepList.length-1]
9996

10097
constposition={
10198
levelId,
@@ -181,7 +178,10 @@ export default {
181178
const{ data, position}=context
182179
const{ stepList}=data.stages[position.stageId]
183180
constcurrentStepIndex=stepList.indexOf(position.stepId)
184-
constnextStepId=stepList[currentStepIndex+1]
181+
182+
constnextStepId=(currentStepIndex<stepList.length)
183+
?stepList[currentStepIndex+1]
184+
:position.stepId
185185

186186
constnextPosition={
187187
...context.position,

‎src/state/machine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export const machine = Machine<
126126
},
127127
TestPass:{
128128
onEntry:['testPass','stepComplete'],
129+
onExit:['stepLoadNext'],
129130
after:{
130131
1000:'StepNext',
131132
},
@@ -138,7 +139,6 @@ export const machine = Machine<
138139
},
139140
},
140141
StepNext:{
141-
onEntry:['stepLoadNext'],
142142
after:{
143143
0:[{
144144
target:'Normal',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp