mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Lens] fix merging the existing saved object with the new one instead of replacing (#160260)
Fixes https://github.com/elastic/kibana/issues/160116
This commit is contained in:
parent
7b5b61a2ad
commit
3fc1e68146
1 changed files with 6 additions and 6 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue