-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lens] fix unhandled promise rejection when saving Lens with duplicate title #82195
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
@@ -359,7 +359,6 @@ export function App({ | |||
const docToSave = { | |||
...getLastKnownDocWithoutPinnedFilters()!, | |||
description: saveProps.newDescription, | |||
savedObjectId: saveProps.newCopyOnSave ? undefined : lastKnownDoc.savedObjectId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed savedObjectId
from docToSave
because it is not used and made tracking down how attributeService.wrapAttributes
pulls out the savedObjectId extra tricky
@@ -453,11 +457,6 @@ export function App({ | |||
// eslint-disable-next-line no-console | |||
console.dir(e); | |||
trackUiEvent('save_failed'); | |||
notifications.toasts.addDanger( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove toast notification on save failure. Toast is already displayed by AttributeService.wrapAttributes
@@ -375,25 +374,31 @@ export function App({ | |||
|
|||
const originalInput = saveProps.newCopyOnSave ? undefined : initialInput; | |||
const originalSavedObjectId = (originalInput as LensByReferenceInput)?.savedObjectId; | |||
if (options.saveToLibrary && !originalInput) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed && !originalInput
because this actually caused a title naming conflict without warning users.
Steps to view:
- create and save a lens saved object called "alpha"
- create and save another lens saved object called "bravo"
- edit the first lens saved object. Click save and change the title to "bravo". Click save. The modal should notify user about duplicate title but it does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally on chrome - duplicate title warning is issued correctly when the 'save as new' is on and when it's off.
No error is thrown. Code LGTM too!
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this in Chrome and I couldn't find any broken behavior.
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]async chunks size
History
To update your PR or re-run it, just comment with: |
…e title (elastic#82195) * [lens] fix unhandled promise rejection when saving Lens with duplicate title * more clean up * restore getDisplayName, used by return of checkForDuplicateTitle * fix jest test Co-authored-by: Kibana Machine <[email protected]>
…e title (#82195) (#82342) * [lens] fix unhandled promise rejection when saving Lens with duplicate title * more clean up * restore getDisplayName, used by return of checkForDuplicateTitle * fix jest test Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
fixes #82173
PR adds try/catch around checkForDuplicateTitle to handle rejection when there is a duplicate title