@@ -33,6 +33,9 @@ export const workspaceItemMachine = createMachine(
33
33
startWorkspace : {
34
34
data : TypesGen . WorkspaceBuild
35
35
}
36
+ getWorkspace : {
37
+ data : TypesGen . Workspace
38
+ }
36
39
} ,
37
40
} ,
38
41
tsTypes : { } as import ( "./workspacesXService.typegen" ) . Typegen0 ,
@@ -93,10 +96,11 @@ export const workspaceItemMachine = createMachine(
93
96
{
94
97
target : "waitingToBeUpdated" ,
95
98
cond : "isOutdated" ,
99
+ actions : [ "assignUpdatedData" ] ,
96
100
} ,
97
101
{
98
102
target : "success" ,
99
- actions : " displayUpdatedSuccessMessage",
103
+ actions : [ "assignUpdatedData" , " displayUpdatedSuccessMessage"] ,
100
104
} ,
101
105
] ,
102
106
} ,
@@ -113,7 +117,7 @@ export const workspaceItemMachine = createMachine(
113
117
} ,
114
118
{
115
119
guards : {
116
- isOutdated : ( ctx ) => ! ctx . data . outdated ,
120
+ isOutdated : ( _ , event ) => event . data . outdated ,
117
121
} ,
118
122
services : {
119
123
getTemplate : ( context ) => API . getTemplate ( context . data . template_id ) ,
@@ -124,6 +128,7 @@ export const workspaceItemMachine = createMachine(
124
128
125
129
return API . startWorkspace ( context . data . id , context . updatedTemplate . active_version_id )
126
130
} ,
131
+ getWorkspace : ( context ) => API . getWorkspace ( context . data . id ) ,
127
132
} ,
128
133
actions : {
129
134
assignUpdatedTemplate : assign ( {
@@ -142,7 +147,7 @@ export const workspaceItemMachine = createMachine(
142
147
displayError ( message )
143
148
} ,
144
149
displayUpdatingVersionMessage : ( ) => {
145
- displayMsg ( "Updating your workspace" , "It will be running in a few seconds .")
150
+ displayMsg ( "Updating workspace.. ." )
146
151
} ,
147
152
assignQueuedStatus : assign ( {
148
153
data : ( ctx ) => {
@@ -161,6 +166,9 @@ export const workspaceItemMachine = createMachine(
161
166
displayUpdatedSuccessMessage : ( ) => {
162
167
displaySuccess ( "Workspace updated successfully." )
163
168
} ,
169
+ assignUpdatedData : assign ( {
170
+ data : ( _ , event ) => event . data ,
171
+ } ) ,
164
172
} ,
165
173
} ,
166
174
)
0 commit comments