Skip to content

Commit

Permalink
refactor: call workspace.init from workspace plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
  • Loading branch information
ruanyl committed Aug 8, 2023
1 parent 27d727b commit 66ee512
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/core/public/workspace/workspaces_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,9 @@ export class WorkspacesService implements CoreService<WorkspacesSetup, Workspace
private setFormatUrlWithWorkspaceId(formatFn: WorkspacesStart['formatUrlWithWorkspaceId']) {
this.formatUrlWithWorkspaceId = formatFn;
}
public async setup({ http, uiSettings }: { http: HttpSetup; uiSettings: IUiSettingsClient }) {
public async setup({ http }: { http: HttpSetup; uiSettings: IUiSettingsClient }) {
this.client = new WorkspacesClient(http);

// If workspace was disabled while opening a workspace url, navigate to basePath
if (uiSettings.get('workspace:enabled') === true) {
this.client.init();
}

return {
client: this.client,
formatUrlWithWorkspaceId: (url: string, id: string) => this.formatUrlWithWorkspaceId(url, id),
Expand Down
1 change: 1 addition & 0 deletions src/plugins/workspace/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class WorkspacesPlugin implements Plugin<{}, {}, WorkspacesPluginSetupDep
}

this.coreSetup = core;
core.workspaces.client.init();
core.workspaces.setFormatUrlWithWorkspaceId((url, id) => this.getPatchedUrl(url, id));
/**
* Retrieve workspace id from url
Expand Down

0 comments on commit 66ee512

Please sign in to comment.