Skip to content

[8.x] [kbn-grid-layout] Cleanup memoization and styling (#210285)#210466

Merged
Heenawter merged 1 commit intoelastic:8.xfrom
Heenawter:backport/8.x/pr-210285
Feb 11, 2025
Merged

[8.x] [kbn-grid-layout] Cleanup memoization and styling (#210285)#210466
Heenawter merged 1 commit intoelastic:8.xfrom
Heenawter:backport/8.x/pr-210285

Conversation

@Heenawter
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

## Summary

This PR cleans up the `kbn-grid-layout` code in two ways:
1. Rather than memoizing components in their parents, I swapped to using
`React.memo` for all components, which accomplishes the same behaviour
in a slightly cleaner way.
2. I moved all Emotion style definitions **outside** of the React
components so that we no longer have to re-parse the CSS string on every
render (see [this
comment](elastic/eui#6828 (comment))).

### Checklist

- [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)

(cherry picked from commit 219f31a)

# Conflicts:
#	src/platform/packages/private/kbn-grid-layout/grid/grid_panel/resize_handle.tsx
@Heenawter Heenawter marked this pull request as ready for review February 10, 2025 21:22
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

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
dashboard 596.7KB 597.4KB +721.0B

@Heenawter Heenawter added the backport This PR is a backport of another PR label Feb 11, 2025
@Heenawter Heenawter merged commit b831ff2 into elastic:8.x Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants