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

Commit4e997d8

Browse files
authored
Merge pull request#439 from coderoad/fix/tasks-run-on-reset
prevent commands on reset tutorial
2 parents032057d +d1e7fc3 commit4e997d8

File tree

6 files changed

+39
-21
lines changed

6 files changed

+39
-21
lines changed

‎CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,8 @@ Adds a review page for viewing tutorial content. The review page should be espec
248248
- Supports commands on reset
249249
- Supports running vscode commands anywhere that command line commands can be run
250250
- Admin mode to allow creators to jump between tutorial levels/steps during development
251+
252+
### [0.13.1]
253+
254+
- Add logo
255+
- Fix issue with watcher tests running on reset

‎src/services/hooks/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import*asTfrom'typings'
21
import*asTTfrom'typings/tutorial'
32
import*asgitfrom'../git'
43
importloadCommitsfrom'./utils/loadCommits'
5-
importloadWatchersfrom'./utils/loadWatchers'
4+
import{loadWatchers,resetWatchers}from'./utils/watchers'
65
importopenFilesfrom'./utils/openFiles'
76
importrunCommandsfrom'./utils/runCommands'
87
importrunVSCodeCommandsfrom'./utils/runVSCodeCommands'
@@ -39,6 +38,7 @@ export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> =>
3938
}
4039

4140
exportconstonReset=async(actions:TT.StepActions):Promise<void>=>{
41+
awaitresetWatchers()
4242
awaitrunCommands(actions?.commands)
4343
awaitrunVSCodeCommands(actions?.vscodeCommands)
4444
}

‎src/services/hooks/utils/loadWatchers.tsrenamed to‎src/services/hooks/utils/watchers.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const disposeWatcher = (watcher: string) => {
1414
deletewatcherObject[watcher]
1515
}
1616

17-
constloadWatchers=(watchers:string[]=[]):void=>{
17+
exportconstloadWatchers=(watchers:string[]=[]):void=>{
1818
if(!watchers.length){
1919
// remove all watchers
2020
for(constwatcherofObject.keys(watcherObject)){
@@ -55,4 +55,8 @@ const loadWatchers = (watchers: string[] = []): void => {
5555
}
5656
}
5757

58-
exportdefaultloadWatchers
58+
exportconstresetWatchers=():void=>{
59+
for(constwatcherofObject.keys(watcherObject)){
60+
disposeWatcher(watcher)
61+
}
62+
}

‎typings/index.d.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,28 @@ export interface MachineStateSchema {
8989
states:{
9090
Setup:{
9191
states:{
92-
Startup:{}
93-
ValidateSetup:{}
94-
Start:{}
95-
SelectTutorial:{}
96-
SetupNewTutorial:{}
97-
StartTutorial:{}
92+
Startup:Record<string,unknown>
93+
ValidateSetup:Record<string,unknown>
94+
Start:Record<string,unknown>
95+
SelectTutorial:Record<string,unknown>
96+
SetupNewTutorial:Record<string,unknown>
97+
StartTutorial:Record<string,unknown>
9898
}
9999
}
100100
Tutorial:{
101101
states:{
102102
Level:{
103103
states:{
104-
Load:{}
105-
Normal:{}
106-
TestRunning:{}
107-
StepNext:{}
108-
LevelComplete:{}
109-
LoadNext:{}
104+
Load:Record<string,unknown>
105+
Normal:Record<string,unknown>
106+
TestRunning:Record<string,unknown>
107+
StepNext:Record<string,unknown>
108+
LevelComplete:Record<string,unknown>
109+
LoadNext:Record<string,unknown>
110110
}
111111
}
112-
Completed:{}
112+
Reset:Record<string,unknown>
113+
Completed:Record<string,unknown>
113114
}
114115
}
115116
}

‎web-app/src/Routes.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const Routes = () => {
4242
<Routepaths={{Tutorial:{Level:{Load:true}}}}>
4343
<LoadingPagetext="Loading Level..."processes={context.processes}/>
4444
</Route>
45+
<Routepaths={{Tutorial:{Reset:true}}}>
46+
<LoadingPagetext="Resetting tutorial..."processes={context.processes}/>
47+
</Route>
4548
<Routepaths={{Tutorial:{Level:true,Completed:true}}}>
4649
<TutorialPagesend={send}context={context}state={route.replace('Tutorial.','')}/>
4750
</Route>

‎web-app/src/services/state/machine.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export const createMachine = (options: any) => {
6969
target:'SetupNewTutorial',
7070
actions:['setTutorialContext'],
7171
},
72-
// TODO: handle completed tutorial differently
7372
TUTORIAL_ALREADY_COMPLETE:{
7473
target:'Start',
7574
actions:['setStart'],
@@ -168,9 +167,7 @@ export const createMachine = (options: any) => {
168167
RUN_TEST:{
169168
actions:['runTest'],
170169
},
171-
RUN_RESET:{
172-
actions:['runReset'],
173-
},
170+
RUN_RESET:'#reset-tutorial',
174171
KEY_PRESS_ENTER:{
175172
actions:['runTest'],
176173
},
@@ -234,6 +231,14 @@ export const createMachine = (options: any) => {
234231
},
235232
},
236233
},
234+
Reset:{
235+
id:'reset-tutorial',
236+
onEntry:['runReset'],
237+
onExit:['testClear'],
238+
after:{
239+
3000:'#tutorial',
240+
},
241+
},
237242
Completed:{
238243
id:'completed-tutorial',
239244
on:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp