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

Commit4044c7f

Browse files
committed
fix bug with continue loading init commits
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent89c5289 commit4044c7f

File tree

6 files changed

+34
-24
lines changed

6 files changed

+34
-24
lines changed

‎src/actions/onStartup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ const onStartup = async (context: Context): Promise<void> => {
3333
// continue from tutorial from local storage
3434
consttutorial:TT.Tutorial|null=context.tutorial.get()
3535

36-
// no stored tutorial, must start new tutorial
36+
//NEW:no stored tutorial, must start new tutorial
3737
if(!tutorial||!tutorial.id){
38-
if(TUTORIAL_URL){
38+
if(!!TUTORIAL_URL){
3939
// NEW_FROM_URL
4040
try{
4141
consttutorialRes=awaitfetch(TUTORIAL_URL)
@@ -47,7 +47,7 @@ const onStartup = async (context: Context): Promise<void> => {
4747
console.log(`Failed to load tutorial from url${TUTORIAL_URL} with error "${e.message}"`)
4848
}
4949
}
50-
// NEW
50+
// NEW from start click
5151
send({type:'START_NEW_TUTORIAL',payload:{ env}})
5252
return
5353
}

‎src/actions/onTutorialConfigContinue.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ import * as TT from 'typings/tutorial'
44
importContextfrom'../services/context/context'
55
importtutorialConfigfrom'./utils/tutorialConfig'
66
import{COMMANDS,send}from'../commands'
7+
importloggerfrom'../services/logger'
78

89
constonTutorialConfigContinue=async(action:T.Action,context:Context):Promise<void>=>{
10+
logger('onTutorialConfigContinue',action)
911
try{
10-
consttutorialContinue:TT.Tutorial|null=context.tutorial.get()
11-
if(!tutorialContinue){
12+
consttutorialToContinue:TT.Tutorial|null=context.tutorial.get()
13+
if(!tutorialToContinue){
1214
thrownewError('Invalid tutorial to continue')
1315
}
16+
// update the current stepId on startup
17+
vscode.commands.executeCommand(COMMANDS.SET_CURRENT_POSITION,action.payload.position)
1418
awaittutorialConfig({
15-
data:tutorialContinue,
19+
data:tutorialToContinue,
1620
alreadyConfigured:true,
1721
})
18-
// update the current stepId on startup
19-
vscode.commands.executeCommand(COMMANDS.SET_CURRENT_POSITION,action.payload.position)
2022
}catch(e){
2123
consterror={
2224
type:'UnknownError',

‎src/actions/utils/tutorialConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const tutorialConfig = async ({ data, alreadyConfigured }: TutorialConfigParams)
5252
}
5353
}
5454

55-
awaitvscode.commands.executeCommand(COMMANDS.CONFIG_TEST_RUNNER,data)
55+
awaitvscode.commands.executeCommand(COMMANDS.CONFIG_TEST_RUNNER,{data, alreadyConfigured})
5656

5757
if(!DISABLE_RUN_ON_SAVE){
5858
// verify if file test should run based on document saved

‎src/commands.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,18 @@ export const createCommands = ({ extensionPath, workspaceState }: CreateCommandP
5959
sendToClient=webview.send
6060
}
6161
},
62-
[COMMANDS.CONFIG_TEST_RUNNER]:async(data:TT.Tutorial)=>{
63-
constsetupActions=data.config.setup
64-
if(setupActions){
65-
hooks.onInit(setupActions)
62+
[COMMANDS.CONFIG_TEST_RUNNER]:async({
63+
data,
64+
alreadyConfigured,
65+
}:{
66+
data:TT.Tutorial
67+
alreadyConfigured:boolean
68+
})=>{
69+
if(!alreadyConfigured){
70+
constsetupActions=data.config.setup
71+
if(setupActions){
72+
hooks.onInit(setupActions)
73+
}
6674
}
6775
testRunner=createTestRunner(data,{
6876
onSuccess:(position:T.Position)=>{

‎src/extension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import * as vscode from 'vscode'
22
import{createCommands}from'./commands'
33
import*astelemetryfrom'./services/telemetry'
44

5-
letonDeactivate=()=>{}
5+
letonDeactivate=()=>{
6+
/* placeholder for unsubscribing fn */
7+
}
68

79
// activate run on vscode extension initialization
810
exportconstactivate=(vscodeExt:vscode.ExtensionContext):void=>{

‎web-app/src/services/state/actions/context.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ export const setStart = assign({
1515
},
1616
})
1717

18-
exportconstloadContinuedTutorial=assign((context:T.MachineContext,event:T.MachineEvent):any=>{
19-
return{
20-
env:{
21-
...context.env,
22-
...event.payload.env,
23-
},
24-
tutorial:event.payload.tutorial,
25-
position:event.payload.position,
26-
}
27-
})
18+
exportconstloadContinuedTutorial=assign((context:T.MachineContext,event:T.MachineEvent):any=>({
19+
env:{
20+
...context.env,
21+
...event.payload.env,
22+
},
23+
tutorial:event.payload.tutorial,
24+
position:event.payload.position,
25+
}))
2826

2927
exportconstinitPosition=assign({
3028
position:(context:T.MachineContext,event:T.MachineEvent):any=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp