Skip to content
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

[Workspace] Fix: optimization on handling invalid workspace id in workspace_ui_settings wrapper #6669

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update src/plugins/workspace/server/saved_objects/workspace_ui_settin…
…gs_client_wrapper.ts

Co-authored-by: Yulong Ruan <ruanyu1@gmail.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe and ruanyl authored Apr 29, 2024
commit e774260e225bf186c4ad2fb661f7d024af56680c
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,7 @@
options
);

let workspaceObject: SavedObject<WorkspaceAttribute> = {
id: requestWorkspaceId,
type: 'workspace',
attributes: {
id: requestWorkspaceId,
name: '',
},
references: [],
};
let workspaceObject: SavedObject<WorkspaceAttribute> | null = null

Check failure on line 66 in src/plugins/workspace/server/saved_objects/workspace_ui_settings_client_wrapper.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `;`

try {
workspaceObject = await this.getWorkspaceTypeEnabledClient(wrapperOptions.request).get<
Expand All @@ -80,6 +72,11 @@
} catch (e) {
this.logger.error(`Unable to get workspaceObject on id: ${requestWorkspaceId}`);
}

Check failure on line 75 in src/plugins/workspace/server/saved_objects/workspace_ui_settings_client_wrapper.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Delete `········`
configObject.attributes = {
...configObject.attributes,
...(workspaceObject ? workspaceObject.attributes.uiSettings : {}),
};

configObject.attributes = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems the configObject.attributes has already been set above. Why we need to assign it again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, remove the useless assign.

...configObject.attributes,
Expand Down
Loading