Skip to content

[dashboard] Ensure we fetch IDEOptions onload + onNewInstance #8250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions components/dashboard/src/start/StartWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
}

if (this.props.dontAutostart) {
// we saw errors previously, or run in-frame
this.fetchWorkspaceInfo(undefined);
return;
} else {
// dashboard case (w/o previous errors): start workspace as quickly as possible
this.startWorkspace();
}

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

componentWillUnmount() {
Expand Down Expand Up @@ -260,6 +261,17 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
}
}

/**
* Fetches the current IDEOptions config for this user
*
* TODO(gpl) Ideally this would be part of the WorkspaceInstance shape, really. And we'd display options based on
* what support it was started with.
*/
protected async fetchIDEOptions() {
const ideOptions = await getGitpodService().server.getIDEOptions();
this.setState({ ideOptions });
}

notifyDidOpenConnection() {
this.fetchWorkspaceInfo(undefined);
}
Expand All @@ -283,6 +295,9 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
startedInstanceId: workspaceInstance.id,
workspaceInstance,
});

// now we're listening to a new instance, which might have been started with other IDEoptions
this.fetchIDEOptions();
}

await this.ensureWorkspaceAuth(workspaceInstance.id);
Expand Down