-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[kbn-grid-layout] Store rows in object instead of array #212965
[kbn-grid-layout] Store rows in object instead of array #212965
Conversation
f3db5d9
to
daea05f
Compare
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
History
cc @Heenawter |
Pinging @elastic/kibana-presentation (Team:Presentation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes are very straightforward and LGTM!
Read through the code and tested locally in the grid example app. Great change!
Starting backport for target branches: 8.x |
Closes elastic#211930 ## Summary This PR makes it so that `kbn-grid-layout` stores its rows as an object / dictionary (`{ [key: string]: GridRowData }`) rather than an array (`Array<GridRowData>`). This is a prerequisite for elastic#190381 , since it allows us to re-order rows without re-rendering their contents. It also means that deleting a row will no longer cause the rows below it to re-render, since re-rendering is now dependant on the row's **ID** rather than the row's order. **Before** https://github.com/user-attachments/assets/83651b24-a32c-4953-8ad5-c0eced163eb5 **After** https://github.com/user-attachments/assets/9cef6dbc-3d62-46aa-bc40-ab24fc4e5556 ### 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 - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit b32f0fe)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
… (#213162) # Backport This will backport the following commits from `main` to `8.x`: - [[kbn-grid-layout] Store rows in object instead of array (#212965)](#212965) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Hannah Mudge","email":"Heenawter@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-04T20:34:39Z","message":"[kbn-grid-layout] Store rows in object instead of array (#212965)\n\nCloses https://github.com/elastic/kibana/issues/211930\n\n## Summary\n\nThis PR makes it so that `kbn-grid-layout` stores its rows as an object\n/ dictionary (`{ [key: string]: GridRowData }`) rather than an array\n(`Array<GridRowData>`). This is a prerequisite for\nhttps://github.com//issues/190381 , since it allows us to\nre-order rows without re-rendering their contents. It also means that\ndeleting a row will no longer cause the rows below it to re-render,\nsince re-rendering is now dependant on the row's **ID** rather than the\nrow's order.\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/83651b24-a32c-4953-8ad5-c0eced163eb5\n\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/9cef6dbc-3d62-46aa-bc40-ab24fc4e5556\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b32f0fe1e863a599c9d61a38e99c974deec6519a","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","loe:small","release_note:skip","impact:high","Project:Collapsable Panels","backport:version","v9.1.0","v8.19.0"],"title":"[kbn-grid-layout] Store rows in object instead of array","number":212965,"url":"https://github.com/elastic/kibana/pull/212965","mergeCommit":{"message":"[kbn-grid-layout] Store rows in object instead of array (#212965)\n\nCloses https://github.com/elastic/kibana/issues/211930\n\n## Summary\n\nThis PR makes it so that `kbn-grid-layout` stores its rows as an object\n/ dictionary (`{ [key: string]: GridRowData }`) rather than an array\n(`Array<GridRowData>`). This is a prerequisite for\nhttps://github.com//issues/190381 , since it allows us to\nre-order rows without re-rendering their contents. It also means that\ndeleting a row will no longer cause the rows below it to re-render,\nsince re-rendering is now dependant on the row's **ID** rather than the\nrow's order.\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/83651b24-a32c-4953-8ad5-c0eced163eb5\n\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/9cef6dbc-3d62-46aa-bc40-ab24fc4e5556\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b32f0fe1e863a599c9d61a38e99c974deec6519a"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212965","number":212965,"mergeCommit":{"message":"[kbn-grid-layout] Store rows in object instead of array (#212965)\n\nCloses https://github.com/elastic/kibana/issues/211930\n\n## Summary\n\nThis PR makes it so that `kbn-grid-layout` stores its rows as an object\n/ dictionary (`{ [key: string]: GridRowData }`) rather than an array\n(`Array<GridRowData>`). This is a prerequisite for\nhttps://github.com//issues/190381 , since it allows us to\nre-order rows without re-rendering their contents. It also means that\ndeleting a row will no longer cause the rows below it to re-render,\nsince re-rendering is now dependant on the row's **ID** rather than the\nrow's order.\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/83651b24-a32c-4953-8ad5-c0eced163eb5\n\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/9cef6dbc-3d62-46aa-bc40-ab24fc4e5556\n\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b32f0fe1e863a599c9d61a38e99c974deec6519a"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
Closes #211930
Summary
This PR makes it so that
kbn-grid-layout
stores its rows as an object / dictionary ({ [key: string]: GridRowData }
) rather than an array (Array<GridRowData>
). This is a prerequisite for #190381 , since it allows us to re-order rows without re-rendering their contents. It also means that deleting a row will no longer cause the rows below it to re-render, since re-rendering is now dependant on the row's ID rather than the row's order.Before
Screen.Recording.2025-03-03.at.2.56.19.PM.mov
After
Screen.Recording.2025-03-03.at.2.51.58.PM.mov
Checklist
release_note:*
label is applied per the guidelines