Skip to content

Commit

Permalink
[Lens] fix merging the existing saved object with the new one instead…
Browse files Browse the repository at this point in the history
… of replacing (#160260)

Fixes #160116
  • Loading branch information
mbondyra authored Jun 22, 2023
1 parent 7b5b61a commit 3fc1e68
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 3fc1e68

Please sign in to comment.