Skip to content

Commit e6e1804

Browse files
geroplroboquat
authored andcommitted
[dashboard] Ensure we fetch IDEOptions onload + onNewInstance
1 parent 6a63dd3 commit e6e1804

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

components/dashboard/src/start/StartWorkspace.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,15 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
121121
}
122122

123123
if (this.props.dontAutostart) {
124+
// we saw errors previously, or run in-frame
124125
this.fetchWorkspaceInfo(undefined);
125-
return;
126+
} else {
127+
// dashboard case (w/o previous errors): start workspace as quickly as possible
128+
this.startWorkspace();
126129
}
127130

128-
// dashboard case (no previous errors): start workspace as quickly as possible
129-
this.startWorkspace();
130131
// query IDE options so we can show them if necessary once the workspace is running
131-
getGitpodService().server.getIDEOptions().then(ideOptions => this.setState({ ideOptions }));
132+
this.fetchIDEOptions();
132133
}
133134

134135
componentWillUnmount() {
@@ -260,6 +261,17 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
260261
}
261262
}
262263

264+
/**
265+
* Fetches the current IDEOptions config for this user
266+
*
267+
* TODO(gpl) Ideally this would be part of the WorkspaceInstance shape, really. And we'd display options based on
268+
* what support it was started with.
269+
*/
270+
protected async fetchIDEOptions() {
271+
const ideOptions = await getGitpodService().server.getIDEOptions();
272+
this.setState({ ideOptions });
273+
}
274+
263275
notifyDidOpenConnection() {
264276
this.fetchWorkspaceInfo(undefined);
265277
}
@@ -283,6 +295,9 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
283295
startedInstanceId: workspaceInstance.id,
284296
workspaceInstance,
285297
});
298+
299+
// now we're listening to a new instance, which might have been started with other IDEoptions
300+
this.fetchIDEOptions();
286301
}
287302

288303
await this.ensureWorkspaceAuth(workspaceInstance.id);

0 commit comments

Comments
 (0)