[Embeddable Rebuild] Fix Lens Embeddable defaultTitle from being overwritten by custom title after reload#225664
Conversation
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
ThomThomson
left a comment
There was a problem hiding this comment.
Changes LGTM! Ran this locally to make sure it all worked, and looked through the code. Nice fix!
markov00
left a comment
There was a problem hiding this comment.
This approach just overrides the defaultTitle$ that is already exposed by the dashboardConfig.api.
Is better to evaluate and verify why the current defaultTitle$ doesn't work as expected:
500ae0b to
c3eca1c
Compare
@markov00 Could you please take a look at the latest changes? I tested locally and the defaultTitle works fine. |
…appearing on reload
dbc6286 to
cfbc801
Compare
...rm/plugins/shared/lens/public/react_embeddable/initializers/initialize_dashboard_services.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/lens/public/react_embeddable/lens_embeddable.tsx
Outdated
Show resolved
Hide resolved
…itializers/initialize_dashboard_services.ts Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
nickpeihl
left a comment
There was a problem hiding this comment.
lgtm! I discussed these latest changes offline with @olapawlus and we confirmed that this fixes the bug.
| const defaultTitle$ = new BehaviorSubject<string | undefined>( | ||
| initialState.title || internalApi.attributes$.getValue().title | ||
| ); | ||
| const defaultTitle$ = new BehaviorSubject<string | undefined>(initialState.attributes.title); |
There was a problem hiding this comment.
This is great! The defaultTitle should only ever come from a by-reference Lens embeddable and those properties are formed on the initialState.attributes object. The internalApi.attributes are based on LensRuntimeState which is state stored on a dashboard and those properties should not be used to set the defaultTitle.
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @olapawlus |
markov00
left a comment
There was a problem hiding this comment.
Changes looks good to me, tested locally.
Probably the only think is not super clear is the fact that the "default" title will always remain the same if you unlink from the library a by-reference visualization and can't be changed.
The unlink action adds the the "by reference" title in the SO and this is then always considered the default "forever".
Anyway I believe this is a different topic and we probably need to create an issue for that
|
Starting backport for target branches: 8.19, 9.1 |
|
Starting backport for target branches: 8.19, 9.1 |
…m title after reload (elastic#225664) Bug description (also the bug video below): Fixes a bug where the defaultTitle value in the Lens embeddable was incorrectly overwritten after a dashboard reload. 🐞 Steps to reproduce the issue Add a Lens panel to a dashboard. Save the dashboard. Set a custom title for the panel (e.g. “My Custom Title”). Reload the page. Try to reset the title to default via the panel’s UI (e.g. “Reset to default” action in the panel menu). ❌ Actual behavior The “Reset to default” option is disabled (greyed out) — the app thinks there’s no difference between the current and default title. From a developer perspective: Inspecting the Lens embeddable api object reveals that: The original defaultTitle field was overwritten by the title field during reload — both fields now hold the same value. ✅ Expected behavior: Now the default title stays correct after reloading a panel, and is no longer overwritten by the custom title. Before fix: https://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364 After fixing: https://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908 Closes: elastic#225660 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Nick Peihl <nickpeihl@gmail.com> (cherry picked from commit 3128f80)
…m title after reload (elastic#225664) Bug description (also the bug video below): Fixes a bug where the defaultTitle value in the Lens embeddable was incorrectly overwritten after a dashboard reload. 🐞 Steps to reproduce the issue Add a Lens panel to a dashboard. Save the dashboard. Set a custom title for the panel (e.g. “My Custom Title”). Reload the page. Try to reset the title to default via the panel’s UI (e.g. “Reset to default” action in the panel menu). ❌ Actual behavior The “Reset to default” option is disabled (greyed out) — the app thinks there’s no difference between the current and default title. From a developer perspective: Inspecting the Lens embeddable api object reveals that: The original defaultTitle field was overwritten by the title field during reload — both fields now hold the same value. ✅ Expected behavior: Now the default title stays correct after reloading a panel, and is no longer overwritten by the custom title. Before fix: https://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364 After fixing: https://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908 Closes: elastic#225660 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Nick Peihl <nickpeihl@gmail.com> (cherry picked from commit 3128f80)
…m title after reload (elastic#225664) Bug description (also the bug video below): Fixes a bug where the defaultTitle value in the Lens embeddable was incorrectly overwritten after a dashboard reload. 🐞 Steps to reproduce the issue Add a Lens panel to a dashboard. Save the dashboard. Set a custom title for the panel (e.g. “My Custom Title”). Reload the page. Try to reset the title to default via the panel’s UI (e.g. “Reset to default” action in the panel menu). ❌ Actual behavior The “Reset to default” option is disabled (greyed out) — the app thinks there’s no difference between the current and default title. From a developer perspective: Inspecting the Lens embeddable api object reveals that: The original defaultTitle field was overwritten by the title field during reload — both fields now hold the same value. ✅ Expected behavior: Now the default title stays correct after reloading a panel, and is no longer overwritten by the custom title. Before fix: https://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364 After fixing: https://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908 Closes: elastic#225660 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Nick Peihl <nickpeihl@gmail.com> (cherry picked from commit 3128f80)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…m title after reload (elastic#225664) Bug description (also the bug video below): Fixes a bug where the defaultTitle value in the Lens embeddable was incorrectly overwritten after a dashboard reload. 🐞 Steps to reproduce the issue Add a Lens panel to a dashboard. Save the dashboard. Set a custom title for the panel (e.g. “My Custom Title”). Reload the page. Try to reset the title to default via the panel’s UI (e.g. “Reset to default” action in the panel menu). ❌ Actual behavior The “Reset to default” option is disabled (greyed out) — the app thinks there’s no difference between the current and default title. From a developer perspective: Inspecting the Lens embeddable api object reveals that: The original defaultTitle field was overwritten by the title field during reload — both fields now hold the same value. ✅ Expected behavior: Now the default title stays correct after reloading a panel, and is no longer overwritten by the custom title. Before fix: https://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364 After fixing: https://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908 Closes: elastic#225660 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Nick Peihl <nickpeihl@gmail.com> (cherry picked from commit 3128f80)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
… custom title after reload (#225664) (#226216) # Backport This will backport the following commits from `main` to `9.1`: - [[Embeddable Rebuild] Fix defaultTitle from being overwritten by custom title after reload (#225664)](#225664) <!--- 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-07-02T13:38:51Z","message":"[Embeddable Rebuild] Fix defaultTitle from being overwritten by custom title after reload (#225664)\n\nBug description (also the bug video below):\nFixes a bug where the defaultTitle value in the Lens embeddable was\nincorrectly overwritten after a dashboard reload.\n\n🐞 Steps to reproduce the issue\nAdd a Lens panel to a dashboard.\nSave the dashboard.\nSet a custom title for the panel (e.g. “My Custom Title”).\nReload the page.\nTry to reset the title to default via the panel’s UI (e.g. “Reset to\ndefault” action in the panel menu).\n❌ Actual behavior\nThe “Reset to default” option is disabled (greyed out) — the app thinks\nthere’s no difference between the current and default title.\n\nFrom a developer perspective:\nInspecting the Lens embeddable api object reveals that:\n\nThe original defaultTitle field was overwritten by the title field\nduring reload — both fields now hold the same value.\n✅ Expected behavior:\nNow the default title stays correct after reloading a panel, and is no\nlonger overwritten by the custom title.\n\nBefore fix:\n\n\nhttps://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364\n\n\nAfter fixing:\n\n\nhttps://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908\n\n\nCloses: #225660\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick Peihl <nickpeihl@gmail.com>","sha":"3128f80147d75a624b193d5e64ca6c0a83246f82","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","regression","release_note:fix","Team:Presentation","loe:medium","Team:Visualizations","impact:medium","project:embeddableRebuild","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Embeddable Rebuild] Fix Lens Embeddable defaultTitle from being overwritten by custom title after reload","number":225664,"url":"https://github.com/elastic/kibana/pull/225664","mergeCommit":{"message":"[Embeddable Rebuild] Fix defaultTitle from being overwritten by custom title after reload (#225664)\n\nBug description (also the bug video below):\nFixes a bug where the defaultTitle value in the Lens embeddable was\nincorrectly overwritten after a dashboard reload.\n\n🐞 Steps to reproduce the issue\nAdd a Lens panel to a dashboard.\nSave the dashboard.\nSet a custom title for the panel (e.g. “My Custom Title”).\nReload the page.\nTry to reset the title to default via the panel’s UI (e.g. “Reset to\ndefault” action in the panel menu).\n❌ Actual behavior\nThe “Reset to default” option is disabled (greyed out) — the app thinks\nthere’s no difference between the current and default title.\n\nFrom a developer perspective:\nInspecting the Lens embeddable api object reveals that:\n\nThe original defaultTitle field was overwritten by the title field\nduring reload — both fields now hold the same value.\n✅ Expected behavior:\nNow the default title stays correct after reloading a panel, and is no\nlonger overwritten by the custom title.\n\nBefore fix:\n\n\nhttps://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364\n\n\nAfter fixing:\n\n\nhttps://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908\n\n\nCloses: #225660\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick Peihl <nickpeihl@gmail.com>","sha":"3128f80147d75a624b193d5e64ca6c0a83246f82"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225664","number":225664,"mergeCommit":{"message":"[Embeddable Rebuild] Fix defaultTitle from being overwritten by custom title after reload (#225664)\n\nBug description (also the bug video below):\nFixes a bug where the defaultTitle value in the Lens embeddable was\nincorrectly overwritten after a dashboard reload.\n\n🐞 Steps to reproduce the issue\nAdd a Lens panel to a dashboard.\nSave the dashboard.\nSet a custom title for the panel (e.g. “My Custom Title”).\nReload the page.\nTry to reset the title to default via the panel’s UI (e.g. “Reset to\ndefault” action in the panel menu).\n❌ Actual behavior\nThe “Reset to default” option is disabled (greyed out) — the app thinks\nthere’s no difference between the current and default title.\n\nFrom a developer perspective:\nInspecting the Lens embeddable api object reveals that:\n\nThe original defaultTitle field was overwritten by the title field\nduring reload — both fields now hold the same value.\n✅ Expected behavior:\nNow the default title stays correct after reloading a panel, and is no\nlonger overwritten by the custom title.\n\nBefore fix:\n\n\nhttps://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364\n\n\nAfter fixing:\n\n\nhttps://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908\n\n\nCloses: #225660\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick Peihl <nickpeihl@gmail.com>","sha":"3128f80147d75a624b193d5e64ca6c0a83246f82"}}]}] BACKPORT--> Co-authored-by: Ola Pawlus <98127445+olapawlus@users.noreply.github.com> Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
…y custom title after reload (#225664) (#226215) # Backport This will backport the following commits from `main` to `8.19`: - [[Embeddable Rebuild] Fix defaultTitle from being overwritten by custom title after reload (#225664)](#225664) <!--- 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-07-02T13:38:51Z","message":"[Embeddable Rebuild] Fix defaultTitle from being overwritten by custom title after reload (#225664)\n\nBug description (also the bug video below):\nFixes a bug where the defaultTitle value in the Lens embeddable was\nincorrectly overwritten after a dashboard reload.\n\n🐞 Steps to reproduce the issue\nAdd a Lens panel to a dashboard.\nSave the dashboard.\nSet a custom title for the panel (e.g. “My Custom Title”).\nReload the page.\nTry to reset the title to default via the panel’s UI (e.g. “Reset to\ndefault” action in the panel menu).\n❌ Actual behavior\nThe “Reset to default” option is disabled (greyed out) — the app thinks\nthere’s no difference between the current and default title.\n\nFrom a developer perspective:\nInspecting the Lens embeddable api object reveals that:\n\nThe original defaultTitle field was overwritten by the title field\nduring reload — both fields now hold the same value.\n✅ Expected behavior:\nNow the default title stays correct after reloading a panel, and is no\nlonger overwritten by the custom title.\n\nBefore fix:\n\n\nhttps://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364\n\n\nAfter fixing:\n\n\nhttps://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908\n\n\nCloses: #225660\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick Peihl <nickpeihl@gmail.com>","sha":"3128f80147d75a624b193d5e64ca6c0a83246f82","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","regression","release_note:fix","Team:Presentation","loe:medium","Team:Visualizations","impact:medium","project:embeddableRebuild","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Embeddable Rebuild] Fix Lens Embeddable defaultTitle from being overwritten by custom title after reload","number":225664,"url":"https://github.com/elastic/kibana/pull/225664","mergeCommit":{"message":"[Embeddable Rebuild] Fix defaultTitle from being overwritten by custom title after reload (#225664)\n\nBug description (also the bug video below):\nFixes a bug where the defaultTitle value in the Lens embeddable was\nincorrectly overwritten after a dashboard reload.\n\n🐞 Steps to reproduce the issue\nAdd a Lens panel to a dashboard.\nSave the dashboard.\nSet a custom title for the panel (e.g. “My Custom Title”).\nReload the page.\nTry to reset the title to default via the panel’s UI (e.g. “Reset to\ndefault” action in the panel menu).\n❌ Actual behavior\nThe “Reset to default” option is disabled (greyed out) — the app thinks\nthere’s no difference between the current and default title.\n\nFrom a developer perspective:\nInspecting the Lens embeddable api object reveals that:\n\nThe original defaultTitle field was overwritten by the title field\nduring reload — both fields now hold the same value.\n✅ Expected behavior:\nNow the default title stays correct after reloading a panel, and is no\nlonger overwritten by the custom title.\n\nBefore fix:\n\n\nhttps://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364\n\n\nAfter fixing:\n\n\nhttps://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908\n\n\nCloses: #225660\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick Peihl <nickpeihl@gmail.com>","sha":"3128f80147d75a624b193d5e64ca6c0a83246f82"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225664","number":225664,"mergeCommit":{"message":"[Embeddable Rebuild] Fix defaultTitle from being overwritten by custom title after reload (#225664)\n\nBug description (also the bug video below):\nFixes a bug where the defaultTitle value in the Lens embeddable was\nincorrectly overwritten after a dashboard reload.\n\n🐞 Steps to reproduce the issue\nAdd a Lens panel to a dashboard.\nSave the dashboard.\nSet a custom title for the panel (e.g. “My Custom Title”).\nReload the page.\nTry to reset the title to default via the panel’s UI (e.g. “Reset to\ndefault” action in the panel menu).\n❌ Actual behavior\nThe “Reset to default” option is disabled (greyed out) — the app thinks\nthere’s no difference between the current and default title.\n\nFrom a developer perspective:\nInspecting the Lens embeddable api object reveals that:\n\nThe original defaultTitle field was overwritten by the title field\nduring reload — both fields now hold the same value.\n✅ Expected behavior:\nNow the default title stays correct after reloading a panel, and is no\nlonger overwritten by the custom title.\n\nBefore fix:\n\n\nhttps://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364\n\n\nAfter fixing:\n\n\nhttps://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908\n\n\nCloses: #225660\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick Peihl <nickpeihl@gmail.com>","sha":"3128f80147d75a624b193d5e64ca6c0a83246f82"}}]}] BACKPORT--> Co-authored-by: Ola Pawlus <98127445+olapawlus@users.noreply.github.com> Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
…m title after reload (elastic#225664) Bug description (also the bug video below): Fixes a bug where the defaultTitle value in the Lens embeddable was incorrectly overwritten after a dashboard reload. 🐞 Steps to reproduce the issue Add a Lens panel to a dashboard. Save the dashboard. Set a custom title for the panel (e.g. “My Custom Title”). Reload the page. Try to reset the title to default via the panel’s UI (e.g. “Reset to default” action in the panel menu). ❌ Actual behavior The “Reset to default” option is disabled (greyed out) — the app thinks there’s no difference between the current and default title. From a developer perspective: Inspecting the Lens embeddable api object reveals that: The original defaultTitle field was overwritten by the title field during reload — both fields now hold the same value. ✅ Expected behavior: Now the default title stays correct after reloading a panel, and is no longer overwritten by the custom title. Before fix: https://github.com/user-attachments/assets/5ab337de-799e-45e9-afea-168f29419364 After fixing: https://github.com/user-attachments/assets/c4f1d893-fc71-424f-aa63-a3b904a37908 Closes: elastic#225660 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
Bug description (also the bug video below):
Fixes a bug where the defaultTitle value in the Lens embeddable was incorrectly overwritten after a dashboard reload.
🐞 Steps to reproduce the issue
Add a Lens panel to a dashboard.
Save the dashboard.
Set a custom title for the panel (e.g. “My Custom Title”).
Reload the page.
Try to reset the title to default via the panel’s UI (e.g. “Reset to default” action in the panel menu).
❌ Actual behavior
The “Reset to default” option is disabled (greyed out) — the app thinks there’s no difference between the current and default title.
From a developer perspective:
Inspecting the Lens embeddable api object reveals that:
The original defaultTitle field was overwritten by the title field during reload — both fields now hold the same value.
✅ Expected behavior:
Now the default title stays correct after reloading a panel, and is no longer overwritten by the custom title.
Before fix:
Screen.Recording.2025-06-30.at.15.32.28.mov
After fixing:
Screen.Recording.2025-06-30.at.15.21.43.mov
Closes: #225660