Skip to content

Comments

[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle#225237

Merged
olapawlus merged 2 commits intoelastic:mainfrom
olapawlus:panelTitleSyncWithSO
Jun 26, 2025
Merged

[Embeddable Rebuild] Fix panel title sync with saved object when using defaultTitle#225237
olapawlus merged 2 commits intoelastic:mainfrom
olapawlus:panelTitleSyncWithSO

Conversation

@olapawlus
Copy link
Member

@olapawlus olapawlus commented Jun 25, 2025

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

  1. Add a panel from the library to the Dashboard
  2. Open the Customize Panel editor using the settings icon
  3. Without changing the title, click Apply button to exit the editor

🔥 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

  1. Add a panel from the library to the Dashboard
  2. Open the Customize Panel editor and update the title to a custom one
  3. Click Apply
  4. Reopen the Customize Panel editor
  5. Click Reset to default to restore the original title

🔥 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

@olapawlus olapawlus self-assigned this Jun 25, 2025
@olapawlus olapawlus added the bug Fixes for quality problems that affect the customer experience label Jun 25, 2025
@olapawlus olapawlus requested a review from a team as a code owner June 25, 2025 09:29
@olapawlus olapawlus added regression Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// loe:small Small Level of Effort impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. project:embeddableRebuild labels Jun 25, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@olapawlus olapawlus enabled auto-merge (squash) June 25, 2025 10:11
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #117 / Cloud Security Posture Test adding Cloud Security Posture Integrations CSPM AWS CIS_AWS Single Manual Direct Access CIS_AWS Single Manual Direct Access Workflow

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
presentationPanel 95.7KB 95.8KB +138.0B

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, thanks for catching that!

@ThomThomson
Copy link
Contributor

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:

  1. Add a Lens panel from the library to a Dashboard
  2. Give the lens panel a custom title and apply it
  3. Leave the Dashboard and come back
  4. Open the Customize Panel editor and try to reset the title
  5. 🔥 Reset is greyed out when it should be available - to reset the title back to the library title.

@olapawlus
Copy link
Member Author

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:

  1. Add a Lens panel from the library to a Dashboard
  2. Give the lens panel a custom title and apply it
  3. Leave the Dashboard and come back
  4. Open the Customize Panel editor and try to reset the title
  5. 🔥 Reset is greyed out when it should be available - to reset the title back to the library title.

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!

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding test case
code review only

@olapawlus olapawlus merged commit cead1a7 into elastic:main Jun 26, 2025
11 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15901716304

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 26, 2025
…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)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 30, 2025
@kibanamachine
Copy link
Contributor

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.
cc: @olapawlus

kibanamachine added a commit that referenced this pull request Jul 1, 2025
…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>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort project:embeddableRebuild regression release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Embeddable Rebuild] Keep panel title in sync with saved object title

5 participants