[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle#225237
[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle#225237olapawlus merged 2 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
cc @olapawlus |
| if (panelTitle !== api.title$?.value) api.setTitle?.(panelTitle); | ||
| // If the panel title matches the default title, we set api.title to undefined to indicate there's no custom title. | ||
| // This ensures the panel stays in sync with the centrally saved object's title and reflects any updates to its title. | ||
| if (panelTitle === api?.defaultTitle$?.value) { |
There was a problem hiding this comment.
Can you add a test case to src/platform/plugins/private/presentation_panel/public/panel_actions/customize_panel_action/customize_panel_editor.test.tsx for this case?
There was a problem hiding this comment.
Of course, thanks for catching that!
|
Changes to the customize panel editor look good to me! I ran into another (maybe related) bug with the title of a Lens panel, that might be worth fixing in this PR also:
|
I’ll open a new PR to keep the changes organized, since after testing this case it seems to be Lens-specific. Thanks for catching that, Devon! |
nreese
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding test case
code review only
|
Starting backport for target branches: 8.19 https://github.com/elastic/kibana/actions/runs/15901716304 |
…g defaultTitle (elastic#225237) ## Summary Bug description (also the bug video below): The bug occurred in the Customize Panel Editor, where the PanelTitle—even when matching the defaultTitle from the central Saved Object—was not always properly synchronized with that object. This led to situations where the title was incorrectly stored as a custom override, breaking the link to the saved object. There were two specific cases where this happened: Adding a panel from the library, then opening Customize Panel and clicking Apply without making changes After adding a panel from the library, the user opens the Customize Panel Editor via the settings icon. Without making any changes to the title, they exit the editor by clicking the Apply button instead of the close icon. This causes the defaultTitle to be unnecessarily written into the title field of the API object, which then treats it as a custom title—breaking future synchronization with the saved object. Resetting the title to default after a change The user changes the panel title in the Customize Panel Editor and clicks Apply. Later, they reopen the editor and click Reset to default. This correctly restores the title from the central saved object, but it is again written into the title field of the API object. Although the value matches the current defaultTitle, it is now treated as custom. If the central title changes later, the panel title will no longer update—breaking synchronization again. Fix: The logic was updated to correctly detect when the panel title matches the defaultTitle. In such cases, it clears the title field in the API (by setting it to undefined) to indicate that the panel should inherit the title from the saved object. This ensures proper synchronization: any future updates to the saved object's title will be reflected automatically in the panel. Closes elastic#188858 Below the bug video: https://github.com/user-attachments/assets/f784679c-8eaa-47b4-942d-e3802faee076 (cherry picked from commit cead1a7)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
…en using defaultTitle (#225237) (#225443) # Backport This will backport the following commits from `main` to `8.19`: - [[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle (#225237)](#225237) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Ola Pawlus","email":"98127445+olapawlus@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-26T12:22:53Z","message":"[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle (#225237)\n\n## Summary\n\nBug description (also the bug video below):\nThe bug occurred in the Customize Panel Editor, where the\nPanelTitle—even when matching the defaultTitle from the central Saved\nObject—was not always properly synchronized with that object. This led\nto situations where the title was incorrectly stored as a custom\noverride, breaking the link to the saved object. There were two specific\ncases where this happened:\n\nAdding a panel from the library, then opening Customize Panel and\nclicking Apply without making changes\nAfter adding a panel from the library, the user opens the Customize\nPanel Editor via the settings icon. Without making any changes to the\ntitle, they exit the editor by clicking the Apply button instead of the\nclose icon. This causes the defaultTitle to be unnecessarily written\ninto the title field of the API object, which then treats it as a custom\ntitle—breaking future synchronization with the saved object.\n\nResetting the title to default after a change\nThe user changes the panel title in the Customize Panel Editor and\nclicks Apply. Later, they reopen the editor and click Reset to default.\nThis correctly restores the title from the central saved object, but it\nis again written into the title field of the API object. Although the\nvalue matches the current defaultTitle, it is now treated as custom. If\nthe central title changes later, the panel title will no longer\nupdate—breaking synchronization again.\n\nFix:\nThe logic was updated to correctly detect when the panel title matches\nthe defaultTitle. In such cases, it clears the title field in the API\n(by setting it to undefined) to indicate that the panel should inherit\nthe title from the saved object. This ensures proper synchronization:\nany future updates to the saved object's title will be reflected\nautomatically in the panel.\n\n\nCloses #188858\n\nBelow the bug video:\n\n\nhttps://github.com/user-attachments/assets/f784679c-8eaa-47b4-942d-e3802faee076","sha":"cead1a7821224c15bae08f0dc1af213d6ce4e1a2","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","regression","release_note:fix","Team:Presentation","loe:small","impact:medium","project:embeddableRebuild","backport:version","v9.1.0","v8.19.0"],"title":"[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle","number":225237,"url":"https://github.com/elastic/kibana/pull/225237","mergeCommit":{"message":"[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle (#225237)\n\n## Summary\n\nBug description (also the bug video below):\nThe bug occurred in the Customize Panel Editor, where the\nPanelTitle—even when matching the defaultTitle from the central Saved\nObject—was not always properly synchronized with that object. This led\nto situations where the title was incorrectly stored as a custom\noverride, breaking the link to the saved object. There were two specific\ncases where this happened:\n\nAdding a panel from the library, then opening Customize Panel and\nclicking Apply without making changes\nAfter adding a panel from the library, the user opens the Customize\nPanel Editor via the settings icon. Without making any changes to the\ntitle, they exit the editor by clicking the Apply button instead of the\nclose icon. This causes the defaultTitle to be unnecessarily written\ninto the title field of the API object, which then treats it as a custom\ntitle—breaking future synchronization with the saved object.\n\nResetting the title to default after a change\nThe user changes the panel title in the Customize Panel Editor and\nclicks Apply. Later, they reopen the editor and click Reset to default.\nThis correctly restores the title from the central saved object, but it\nis again written into the title field of the API object. Although the\nvalue matches the current defaultTitle, it is now treated as custom. If\nthe central title changes later, the panel title will no longer\nupdate—breaking synchronization again.\n\nFix:\nThe logic was updated to correctly detect when the panel title matches\nthe defaultTitle. In such cases, it clears the title field in the API\n(by setting it to undefined) to indicate that the panel should inherit\nthe title from the saved object. This ensures proper synchronization:\nany future updates to the saved object's title will be reflected\nautomatically in the panel.\n\n\nCloses #188858\n\nBelow the bug video:\n\n\nhttps://github.com/user-attachments/assets/f784679c-8eaa-47b4-942d-e3802faee076","sha":"cead1a7821224c15bae08f0dc1af213d6ce4e1a2"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225237","number":225237,"mergeCommit":{"message":"[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle (#225237)\n\n## Summary\n\nBug description (also the bug video below):\nThe bug occurred in the Customize Panel Editor, where the\nPanelTitle—even when matching the defaultTitle from the central Saved\nObject—was not always properly synchronized with that object. This led\nto situations where the title was incorrectly stored as a custom\noverride, breaking the link to the saved object. There were two specific\ncases where this happened:\n\nAdding a panel from the library, then opening Customize Panel and\nclicking Apply without making changes\nAfter adding a panel from the library, the user opens the Customize\nPanel Editor via the settings icon. Without making any changes to the\ntitle, they exit the editor by clicking the Apply button instead of the\nclose icon. This causes the defaultTitle to be unnecessarily written\ninto the title field of the API object, which then treats it as a custom\ntitle—breaking future synchronization with the saved object.\n\nResetting the title to default after a change\nThe user changes the panel title in the Customize Panel Editor and\nclicks Apply. Later, they reopen the editor and click Reset to default.\nThis correctly restores the title from the central saved object, but it\nis again written into the title field of the API object. Although the\nvalue matches the current defaultTitle, it is now treated as custom. If\nthe central title changes later, the panel title will no longer\nupdate—breaking synchronization again.\n\nFix:\nThe logic was updated to correctly detect when the panel title matches\nthe defaultTitle. In such cases, it clears the title field in the API\n(by setting it to undefined) to indicate that the panel should inherit\nthe title from the saved object. This ensures proper synchronization:\nany future updates to the saved object's title will be reflected\nautomatically in the panel.\n\n\nCloses #188858\n\nBelow the bug video:\n\n\nhttps://github.com/user-attachments/assets/f784679c-8eaa-47b4-942d-e3802faee076","sha":"cead1a7821224c15bae08f0dc1af213d6ce4e1a2"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Ola Pawlus <98127445+olapawlus@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Bug description (also the bug video below):
The bug occurred in the Customize Panel Editor, where the PanelTitle—even when matching the defaultTitle from the central Saved Object—was not always properly synchronized with that object. This led to situations where the default panel title was incorrectly stored as a custom override, breaking the link to the saved object. There were two specific cases where this happened:
🧪 Add a panel from the library, then click apply button without making changes
🔥 This writes the defaultTitle into the API title field unnecessarily, making it look like a custom title. This breaks future title synchronization with the saved object.
🧪 Change the panel title, then reset to default
🔥 Although the UI shows the correct library title again, it's written into the API title field. Since it's now stored as a custom value, future updates to the library title won’t be reflected—breaking synchronization.
Fix:
The logic was updated to correctly detect when the panel title matches the defaultTitle. In such cases, it clears the title field in the API (by setting it to
undefined) to indicate that the panel should inherit the title from the saved object. This ensures proper synchronization: any future updates to the saved object's title will be reflected automatically in the panel.Closes #188858
Below the bug video:
Screen.Recording.2025-06-25.at.11.31.04.mov