From fd06f9d045cd7c7a18e368881431c8603d8ce3eb Mon Sep 17 00:00:00 2001 From: Devon A Thomson Date: Thu, 10 Sep 2020 16:30:52 -0400 Subject: [PATCH] undid changes to saved_object_store --- .../lens/public/persistence/saved_object_store.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/lens/public/persistence/saved_object_store.ts b/x-pack/plugins/lens/public/persistence/saved_object_store.ts index f2dfb65f9a272..e4609213ec792 100644 --- a/x-pack/plugins/lens/public/persistence/saved_object_store.ts +++ b/x-pack/plugins/lens/public/persistence/saved_object_store.ts @@ -40,7 +40,11 @@ export interface DocumentLoader { export type SavedObjectStore = DocumentLoader & DocumentSaver; export class SavedObjectIndexStore implements SavedObjectStore { - constructor(private client: SavedObjectsClientContract) {} + private client: SavedObjectsClientContract; + + constructor(client: SavedObjectsClientContract) { + this.client = client; + } async save(vis: Document) { const { id, type, references, ...rest } = vis; @@ -53,6 +57,7 @@ export class SavedObjectIndexStore implements SavedObjectStore { : this.client.create(DOC_TYPE, attributes, { references, })); + return { ...vis, id: result.id }; } @@ -85,12 +90,12 @@ export class SavedObjectIndexStore implements SavedObjectStore { if (error) { throw error; } - const document = { + + return { ...(attributes as SavedObjectAttributes), references, id, type, } as Document; - return document; } }