Skip to content

Commit

Permalink
Update embeddable.tsx
Browse files Browse the repository at this point in the history
make sure conflict error logic will execute
  • Loading branch information
mbondyra authored Dec 1, 2021
1 parent 0f21c6f commit f3d9991
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions x-pack/plugins/lens/public/embeddable/embeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ export class Embeddable
}

private maybeAddConflictError(
errors: ErrorMessage[],
errors?: ErrorMessage[],
sharingSavedObjectProps?: SharingSavedObjectProps
) {
const ret = [...errors];
const ret = [...(errors || [])];

if (sharingSavedObjectProps?.outcome === 'conflict' && !!this.deps.spaces) {
ret.push({
Expand All @@ -303,7 +303,7 @@ export class Embeddable
});
}

return ret;
return ret?.length ? ret : undefined;
}

async initializeSavedVis(input: LensEmbeddableInput) {
Expand All @@ -330,7 +330,7 @@ export class Embeddable
this.deps.documentToExpression
);
this.expression = expression;
this.errors = errors && this.maybeAddConflictError(errors, metaInfo?.sharingSavedObjectProps);
this.errors = this.maybeAddConflictError(errors, metaInfo?.sharingSavedObjectProps);

if (this.errors) {
this.logError('validation');
Expand Down

0 comments on commit f3d9991

Please sign in to comment.