Skip to content

Commit a369df6

Browse files
committed
fix continue
Signed-off-by: shmck <[email protected]>
1 parent b44914a commit a369df6

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

Diff for: web-app/src/containers/Start/index.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ interface ContainerProps {
8686
const StartPageContainer = ({ context, send }: ContainerProps) => {
8787
const tutorial = context.tutorial || undefined
8888
return (
89-
<StartPage onContinue={() => send('CONTINUE_TUTORIAL')} onNew={() => send('NEW_TUTORIAL')} tutorial={tutorial} />
89+
<StartPage
90+
onContinue={() => send({ type: 'CONTINUE_TUTORIAL' })}
91+
onNew={() => send({ type: 'NEW_TUTORIAL' })}
92+
tutorial={tutorial}
93+
/>
9094
)
9195
}
9296

Diff for: web-app/src/services/state/actions/context.ts

+11-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as TT from 'typings/tutorial'
33
import { assign, send, ActionFunctionMap } from 'xstate'
44
import * as selectors from '../../selectors'
55
import onError from '../../../services/sentry/onError'
6-
import logger from 'services/logger'
6+
import logger from '../../../services/logger'
77

88
const contextActions: ActionFunctionMap<T.MachineContext, T.MachineEvent> = {
99
// @ts-ignore
@@ -16,25 +16,20 @@ const contextActions: ActionFunctionMap<T.MachineContext, T.MachineEvent> = {
1616
},
1717
}),
1818
// @ts-ignore
19-
storeContinuedTutorial: assign({
20-
env: (context: T.MachineContext, event: T.MachineEvent) => {
21-
return {
19+
loadContinuedTutorial: assign((context: T.MachineContext, event: T.MachineEvent): any => {
20+
return {
21+
env: {
2222
...context.env,
2323
...event.payload.env,
24-
}
25-
},
26-
tutorial: (context: T.MachineContext, event: T.MachineEvent) => {
27-
return event.payload.tutorial
28-
},
29-
progress: (context: T.MachineContext, event: T.MachineEvent) => {
30-
return event.payload.progress
31-
},
32-
position: (context: T.MachineContext, event: T.MachineEvent) => {
33-
return event.payload.position
34-
},
24+
},
25+
tutorial: event.payload.tutorial,
26+
progress: event.payload.progress,
27+
position: event.payload.position,
28+
}
3529
}),
30+
3631
// @ts-ignore
37-
startTutorial: assign({
32+
initProgressPosition: assign({
3833
position: (context: T.MachineContext, event: T.MachineEvent): any => {
3934
const position: T.Position = selectors.initialPosition(context)
4035
return position

Diff for: web-app/src/services/state/machine.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const createMachine = (options: any) => {
6464
},
6565
LOAD_STORED_TUTORIAL: {
6666
target: 'Start',
67-
actions: ['storeContinuedTutorial'],
67+
actions: ['loadContinuedTutorial'],
6868
},
6969
START_NEW_TUTORIAL: {
7070
target: 'Start',
@@ -97,7 +97,7 @@ export const createMachine = (options: any) => {
9797
on: {
9898
NEW_TUTORIAL: 'ValidateSetup',
9999
CONTINUE_TUTORIAL: {
100-
target: 'StartTutorial',
100+
target: '#tutorial',
101101
actions: ['continueConfig'],
102102
},
103103
CONTINUE_FAILED: {
@@ -127,7 +127,7 @@ export const createMachine = (options: any) => {
127127
},
128128
},
129129
StartTutorial: {
130-
onEntry: ['startTutorial'],
130+
onEntry: ['initProgressPosition'],
131131
after: {
132132
0: '#tutorial',
133133
},

0 commit comments

Comments
 (0)