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] Fix table sorting on time picker interval change #182173

Merged
merged 3 commits into from
May 1, 2024

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Apr 30, 2024

Summary

Fixes #182153

Due to some specific implementation of the schema sorting in the EUI datagrid, sometimes the table row can be null/undefined and the comparison function utility wasn't prepared for that.
Now the utility is resilient to null rows.

Checklist

@dej611 dej611 added release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens v8.14.0 v8.13.3 v8.15.0 labels Apr 30, 2024
@nickofthyme
Copy link
Contributor

/ci

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

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 +73.0B

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

Copy link
Contributor

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

Code changes LGTM, tested locally and resolves issue.

@@ -218,15 +226,19 @@ function getUndefinedHandler(
if (valueB == null || Number.isNaN(valueB)) {
return -1;
}
return sortingCriteria(rowA, rowB, direction);
return sortingCriteria(rowA!, rowB!, direction);
Copy link
Contributor

Choose a reason for hiding this comment

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

Type guards are always preferable to ! 💥

@nickofthyme nickofthyme marked this pull request as ready for review May 1, 2024 05:03
@nickofthyme nickofthyme requested a review from a team as a code owner May 1, 2024 05:03
@elasticmachine
Copy link
Contributor

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

@nickofthyme nickofthyme merged commit 085d236 into elastic:main May 1, 2024
31 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 1, 2024
## Summary

Fixes elastic#182153

Due to some specific implementation of the schema sorting in the EUI
datagrid, sometimes the table row can be `null/undefined` and the
comparison function utility wasn't prepared for that.
Now the utility is resilient to `null` rows.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 085d236)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 1, 2024
## Summary

Fixes elastic#182153

Due to some specific implementation of the schema sorting in the EUI
datagrid, sometimes the table row can be `null/undefined` and the
comparison function utility wasn't prepared for that.
Now the utility is resilient to `null` rows.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 085d236)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.13
8.14

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 1, 2024
…) (#182215)

# Backport

This will backport the following commits from `main` to `8.13`:
- [[Lens] Fix table sorting on time picker interval change
(#182173)](#182173)

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

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

<!--BACKPORT [{"author":{"name":"Marco
Liberati","email":"dej611@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-05-01T05:04:29Z","message":"[Lens]
Fix table sorting on time picker interval change (#182173)\n\n##
Summary\r\n\r\nFixes #182153 \r\n\r\nDue to some specific implementation
of the schema sorting in the EUI\r\ndatagrid, sometimes the table row
can be `null/undefined` and the\r\ncomparison function utility wasn't
prepared for that.\r\nNow the utility is resilient to `null`
rows.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"085d2368b08df645966a450025e297524682da4a","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","v8.14.0","v8.13.3","v8.15.0"],"title":"[Lens]
Fix table sorting on time picker interval
change","number":182173,"url":"#182173
Fix table sorting on time picker interval change (#182173)\n\n##
Summary\r\n\r\nFixes #182153 \r\n\r\nDue to some specific implementation
of the schema sorting in the EUI\r\ndatagrid, sometimes the table row
can be `null/undefined` and the\r\ncomparison function utility wasn't
prepared for that.\r\nNow the utility is resilient to `null`
rows.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"085d2368b08df645966a450025e297524682da4a"}},"sourceBranch":"main","suggestedTargetBranches":["8.14","8.13"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.13","label":"v8.13.3","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":"#182173
Fix table sorting on time picker interval change (#182173)\n\n##
Summary\r\n\r\nFixes #182153 \r\n\r\nDue to some specific implementation
of the schema sorting in the EUI\r\ndatagrid, sometimes the table row
can be `null/undefined` and the\r\ncomparison function utility wasn't
prepared for that.\r\nNow the utility is resilient to `null`
rows.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"085d2368b08df645966a450025e297524682da4a"}}]}]
BACKPORT-->

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request May 1, 2024
…) (#182216)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[Lens] Fix table sorting on time picker interval change
(#182173)](#182173)

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

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

<!--BACKPORT [{"author":{"name":"Marco
Liberati","email":"dej611@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-05-01T05:04:29Z","message":"[Lens]
Fix table sorting on time picker interval change (#182173)\n\n##
Summary\r\n\r\nFixes #182153 \r\n\r\nDue to some specific implementation
of the schema sorting in the EUI\r\ndatagrid, sometimes the table row
can be `null/undefined` and the\r\ncomparison function utility wasn't
prepared for that.\r\nNow the utility is resilient to `null`
rows.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"085d2368b08df645966a450025e297524682da4a","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","v8.14.0","v8.13.3","v8.15.0"],"title":"[Lens]
Fix table sorting on time picker interval
change","number":182173,"url":"#182173
Fix table sorting on time picker interval change (#182173)\n\n##
Summary\r\n\r\nFixes #182153 \r\n\r\nDue to some specific implementation
of the schema sorting in the EUI\r\ndatagrid, sometimes the table row
can be `null/undefined` and the\r\ncomparison function utility wasn't
prepared for that.\r\nNow the utility is resilient to `null`
rows.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"085d2368b08df645966a450025e297524682da4a"}},"sourceBranch":"main","suggestedTargetBranches":["8.14","8.13"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.13","label":"v8.13.3","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":"#182173
Fix table sorting on time picker interval change (#182173)\n\n##
Summary\r\n\r\nFixes #182153 \r\n\r\nDue to some specific implementation
of the schema sorting in the EUI\r\ndatagrid, sometimes the table row
can be `null/undefined` and the\r\ncomparison function utility wasn't
prepared for that.\r\nNow the utility is resilient to `null`
rows.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"085d2368b08df645966a450025e297524682da4a"}}]}]
BACKPORT-->

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
@bhavyarm
Copy link
Contributor

bhavyarm commented May 2, 2024

This didn't make it to BC2 of 8.13.3. Removing the label Thanks!

@bhavyarm bhavyarm removed the v8.13.3 label May 2, 2024
yuliacech pushed a commit to yuliacech/kibana that referenced this pull request May 3, 2024
## Summary

Fixes elastic#182153 

Due to some specific implementation of the schema sorting in the EUI
datagrid, sometimes the table row can be `null/undefined` and the
comparison function utility wasn't prepared for that.
Now the utility is resilient to `null` rows.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
@mistic mistic added the v8.13.4 label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Changing time picker on table with sorted column triggers error
7 participants