diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/duplicate_result_flyout.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/duplicate_result_flyout.test.tsx.snap
index 598a382c800..b8230387613 100644
--- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/duplicate_result_flyout.test.tsx.snap
+++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/duplicate_result_flyout.test.tsx.snap
@@ -19,6 +19,13 @@ HTMLCollection [
+
+
+
@@ -90,6 +97,13 @@ HTMLCollection [
+
+
+
diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.test.tsx
index 21b15701262..d6bb185646a 100644
--- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.test.tsx
+++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.test.tsx
@@ -112,7 +112,7 @@ describe('DuplicateModal', () => {
expect(options[1].label).toEqual('bar');
});
- it('should display the suffix (current) in target workspace options when in workspace1', async () => {
+ it('should display the suffix (current) in target workspace options when it is the current workspace', async () => {
workspaces.workspaceList$.next(workspaceList);
workspaces.currentWorkspaceId$.next('workspace1');
workspaces.currentWorkspace$.next({
diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx
index 92c32615986..072934a919a 100644
--- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx
+++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx
@@ -71,13 +71,17 @@ export class SavedObjectsDuplicateModal extends React.Component {
+ const selectedWorkspace = this.state.targetWorkspaceOption[0];
+ if (!selectedWorkspace) {
+ return;
+ }
+ const targetWorkspace = selectedWorkspace.key;
+ const targetWorkspaceName = selectedWorkspace.label;
+
this.setState({
isLoading: true,
});
- const targetWorkspace = this.state.targetWorkspaceOption[0].key;
- const targetWorkspaceName = this.state.targetWorkspaceOption[0].label;
-
await this.props.onDuplicate(
savedObjects,
this.state.isIncludeReferencesDeepChecked,
@@ -98,10 +102,10 @@ export class SavedObjectsDuplicateModal extends React.Component {
- this.setState((state) => ({
- isIncludeReferencesDeepChecked: !state.isIncludeReferencesDeepChecked,
- }));
+ changeIncludeReferencesDeep = (e: React.ChangeEvent) => {
+ this.setState({
+ isIncludeReferencesDeepChecked: e.target.checked,
+ });
};
render() {
@@ -137,7 +141,7 @@ export class SavedObjectsDuplicateModal extends React.Component
@@ -210,9 +214,6 @@ export class SavedObjectsDuplicateModal extends React.Component