Skip to content

Commit

Permalink
[Lens] fix deepmerging the existing saved object with the new one ins…
Browse files Browse the repository at this point in the history
…tead of overwriting
  • Loading branch information
mbondyra committed Jun 22, 2023
1 parent d7b2a52 commit da0ca08
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions x-pack/plugins/lens/server/content_management/lens_storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,19 @@ export class LensStorage implements ContentStorage<LensSavedObject, PartialLensS

// Save data in DB
const soClient = await savedObjectClientFromRequest(ctx);
const partialSavedObject = await soClient.update<LensSavedObjectAttributes>(
SO_TYPE,

const savedObject = await soClient.create<LensSavedObjectAttributes>(SO_TYPE, dataToLatest, {
id,
dataToLatest,
optionsToLatest
);
overwrite: true,
...optionsToLatest,
});

// Validate DB response and DOWN transform to the request version
const { value, error: resultError } = transforms.update.out.result.down<
LensUpdateOut,
LensUpdateOut
>({
item: savedObjectToLensSavedObject(partialSavedObject, true),
item: savedObjectToLensSavedObject(savedObject, true),
});

if (resultError) {
Expand Down

0 comments on commit da0ca08

Please sign in to comment.