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

[dashboard] Upgraded dashboard with image embeddable shows "unsaved changes" badge when opening editor #183524

Closed
nreese opened this issue May 15, 2024 · 2 comments · Fixed by #183539
Assignees
Labels
bug Fixes for quality problems that affect the customer experience project:embeddableRebuild regression Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas

Comments

@nreese
Copy link
Contributor

nreese commented May 15, 2024

Steps to view issue

  • Spin up a pre 8.14.0 cloud instance. I used 8.12.2.
  • Create a new dashboard and add an image embeddable.
  • Upgrade cloud instance to 8.14.0
  • open dashboard in edit mode
  • Notice how "Unsaved changes" badge is showing, even though there are no changes to the dashboard.
    Screenshot 2024-05-15 at 8 31 03 AM

The problem

Dashboard stores enhancements as {} prior to 8.14.0. You can see this in the screen shot taken from cloud 8.12.2 instance
Screenshot 2024-05-15 at 7 57 27 AM

The problem arises with how dynamic actions initializes state and comparators. In the code below, state is initialized to { dynamicActions: { events: [] } when enhancements is an empty object.
https://github.com/elastic/kibana/blob/main/x-pack/plugins/embeddable_enhanced/public/plugin.ts#L150

const dynamicActionsState$ = new BehaviorSubject<DynamicActionsSerializedState['enhancements']>(
    { dynamicActions: { events: [] }, ...(state.enhancements ?? {}) }
);

Then, the comparator compares the original state, {}, with the current state { dynamicActions: { events: [] } and flags the state as changed.
https://github.com/elastic/kibana/blob/main/x-pack/plugins/embeddable_enhanced/public/plugin.ts#L175

(a, b) => {
     return deepEqual(a, b);
}
@nreese nreese added bug Fixes for quality problems that affect the customer experience regression project:embeddableRebuild labels May 15, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label May 15, 2024
@nreese nreese added the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas label May 15, 2024
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot removed the needs-team Issues missing a team label label May 15, 2024
@nreese nreese changed the title Imported dashboard with image embeddable shows "unsaved changes" badge when opening editor [dashboard] Upgraded dashboard with image embeddable shows "unsaved changes" badge when opening editor May 15, 2024
@nreese
Copy link
Contributor Author

nreese commented May 15, 2024

blocking #178158

@nreese nreese self-assigned this May 15, 2024
nreese added a commit that referenced this issue May 15, 2024
…ed changes' badge when opening editor (#183539)

Fixes #183524

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue May 15, 2024
…ed changes' badge when opening editor (elastic#183539)

Fixes elastic#183524

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 076e32d)
kibanamachine added a commit that referenced this issue May 15, 2024
… &#x27;unsaved changes&#x27; badge when opening editor (#183539) (#183557)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[dashboard] fix Upgraded dashboard with image embeddable shows
&#x27;unsaved changes&#x27; badge when opening editor
(#183539)](#183539)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2024-05-15T19:22:24Z","message":"[dashboard]
fix Upgraded dashboard with image embeddable shows 'unsaved changes'
badge when opening editor (#183539)\n\nFixes
#183524:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"076e32d79e2c05fc4d7fe34eee83ff801255f21b","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","project:embeddableRebuild","v8.14.0","v8.15.0"],"title":"[dashboard]
fix Upgraded dashboard with image embeddable shows 'unsaved changes'
badge when opening
editor","number":183539,"url":"#183539
fix Upgraded dashboard with image embeddable shows 'unsaved changes'
badge when opening editor (#183539)\n\nFixes
#183524:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"076e32d79e2c05fc4d7fe34eee83ff801255f21b"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"#183539
fix Upgraded dashboard with image embeddable shows 'unsaved changes'
badge when opening editor (#183539)\n\nFixes
#183524:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"076e32d79e2c05fc4d7fe34eee83ff801255f21b"}}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
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 project:embeddableRebuild regression Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas
Projects
None yet
2 participants