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

[Lens] fixed equality check for visualization #172685

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Dec 6, 2023

Summary

Fixed an equality check bug for attributesChanged calculation. It wasn't taking into account that visualization can also have references (to dataview for annotations) and a custom isEqual function.

@mbondyra mbondyra added Team:Visualizations Visualization editors, elastic-charts and infrastructure release_note:skip Skip the PR/issue when compiling release notes Feature:Lens v8.12.0 labels Dec 6, 2023
@mbondyra mbondyra requested a review from a team as a code owner December 6, 2023 14:23
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

const customIsEqual = visualizationMap[previousAttrs.visualizationType]?.isEqual;
const visualizationStateIsEqual = customIsEqual
? (() => {
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why wrapping it in a try here?

Copy link
Contributor Author

@mbondyra mbondyra Dec 6, 2023

Choose a reason for hiding this comment

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

for xy_chart, the implementation of isEqual can throw an error when injecting references for annotations. If there's a problem with annotation from library, it can throw an error.

Screenshot 2023-12-06 at 16 50 11

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. It makes sense then.

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #91 / endpoint Response Actions Responder from the Endpoint list and details should show Responder from the endpoint list

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
lens 1.4MB 1.4MB +198.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Changes LGTM, bug fixed!

@mbondyra mbondyra merged commit 9e41850 into elastic:main Dec 7, 2023
46 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 7, 2023
## Summary

Fixed an equality check bug for attributesChanged calculation. It wasn't
taking into account that visualization can also have references (to
dataview for annotations) and a custom isEqual function.

(cherry picked from commit 9e41850)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.12

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

Questions ?

Please refer to the Backport tool documentation

@mbondyra mbondyra deleted the lens/equality_check branch December 7, 2023 09:47
kibanamachine added a commit that referenced this pull request Dec 7, 2023
# Backport

This will backport the following commits from `main` to `8.12`:
- [[Lens] fixed equality check for visualization
(#172685)](#172685)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"4283304+mbondyra@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-12-07T09:31:38Z","message":"[Lens]
fixed equality check for visualization (#172685)\n\n##
Summary\r\n\r\nFixed an equality check bug for attributesChanged
calculation. It wasn't\r\ntaking into account that visualization can
also have references (to\r\ndataview for annotations) and a custom
isEqual
function.","sha":"9e41850a352a24446a0c49bacffccf93df2547fb","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","v8.12.0","v8.13.0"],"number":172685,"url":"https://github.com/elastic/kibana/pull/172685","mergeCommit":{"message":"[Lens]
fixed equality check for visualization (#172685)\n\n##
Summary\r\n\r\nFixed an equality check bug for attributesChanged
calculation. It wasn't\r\ntaking into account that visualization can
also have references (to\r\ndataview for annotations) and a custom
isEqual
function.","sha":"9e41850a352a24446a0c49bacffccf93df2547fb"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/172685","number":172685,"mergeCommit":{"message":"[Lens]
fixed equality check for visualization (#172685)\n\n##
Summary\r\n\r\nFixed an equality check bug for attributesChanged
calculation. It wasn't\r\ntaking into account that visualization can
also have references (to\r\ndataview for annotations) and a custom
isEqual function.","sha":"9e41850a352a24446a0c49bacffccf93df2547fb"}}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.12.0 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants