Skip to content
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

[Time to Visualize] Unlink from Library does not properly delete savedObjectId #83864

Closed
ThomThomson opened this issue Nov 19, 2020 · 1 comment · Fixed by #83873
Closed

[Time to Visualize] Unlink from Library does not properly delete savedObjectId #83864

ThomThomson opened this issue Nov 19, 2020 · 1 comment · Fixed by #83873
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Dashboard Dashboard related features

Comments

@ThomThomson
Copy link
Contributor

ThomThomson commented Nov 19, 2020

Kibana version: Master with allowByValueEmbeddables flag set to true

Describe the bug: When unlinking a panel from the library, the connection remains. Therefore editing the by value panel will still apply changes to its library item.

Steps to reproduce:

  1. Add a by reference panel to a dashboard
  2. Unlink that panel from the library.
  3. Edit the by value panel (At this point you should also be able to see the saved object id of the panel in the url)
  4. Find the saved object in the library, and notice that the edits from step 3 were applied.

Expected behavior:
Editing a by value panel should only affect the by value panel.

@ThomThomson ThomThomson added bug Fixes for quality problems that affect the customer experience Feature:Dashboard Dashboard related features labels Nov 19, 2020
@ThomThomson ThomThomson self-assigned this Nov 19, 2020
@ThomThomson
Copy link
Contributor Author

ThomThomson commented Nov 19, 2020

Looking into this issue more, it is caused by:

#74253

That PR made the replace panel method retain embeddable IDs, and therefore not recreate embeddables from scratch.

The edit path for most embeddables, which uses the saved Object Id, is created only once at initialization time. Even if the saved object Id subsequently changes, the edit path is not recreated. That means that even though the input of the saved object is by value, the output still has an edit path like lens/{savedObjectId}. As I see it, we have two ways forward to fix this:

1: Add an optional setting to the ReplacePanel method which generates a new id and fully replaces the panel. This way we can retain the changes made in the above PR, while also recreating embeddable from scratch when it's important to do so. #83873

2: Update all by value / by reference embeddables to be able to handle changes to their savedObjectId, and reinitialize themselves accordingly. This is the more correct solution, because embeddables should be able to react to any changes in their inputs. That said, this may not be an excellent solution for right now because it requires a bit of a re-write for each by reference / by value embeddable. Additionally, it means that any embeddables which support by value / by reference in the future need to also support hot savedObjectId changes. Here is a POC implementation of how savedObjectId changing in Lens. #83874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Dashboard Dashboard related features
Projects
None yet
1 participant