-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Remove <NativeRenderer /> #161521
[Lens] Remove <NativeRenderer /> #161521
Conversation
5a2d815
to
9644a3e
Compare
Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations) |
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.
kibana-gis changes LGTM
code review only
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.
Great cleanup, LGTM!
2396d86
to
5d99a96
Compare
2bf0d3a
to
189b6e6
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Unknown metric groupsAPI count
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
The NativeRenderer component is currently used to mount another component in a separate mounting point. As far as I recall, we introduced to allow users to create visualizations in non-React frameworks. The idea was that users could write their own Lens visualizations or datasources code and integrate it with our system. However, it seems that this concept hasn't gained traction and we don’t have it prioritized. Even if users express interest in writing their visualizations outside of React, it is still possible to do so with some additional boilerplate code (which we could provide as an example non-React visualization).
Pros:
Simplifies and shortens the code:
1.1. Testing and debugging become easier as we no longer need to check separate React trees when integrating frame, data source, and visualization components.
1.2. Components communicate using standard React patterns, making maintenance and comprehension simpler.
1.3. Context providers no longer need to be passed to each separate component since they are already within the context.
1.4. Easier propagation of events or any other form of inter-component communication.
Greatly improves performance and facilitates maintenance:
2.1. Directly accessing context inside the DatasourcePanel eliminates the need for context passing, resulting in better performance.
2.2. Removing the requirement for a separate React root also contributes to improved performance.
The render method will be removed when we upgrade to React 18. While we could replace it with the new createRoot method, it makes sense to perform some cleanup ;)
Cons:
Performance improvement for drag and drop action with these changes:
before:
after:
Single render when dragging:
(the first image is 3 screenshots from 3 different react roots as they have separate mounting point. The complete render time is ~380ms)
After we have one common render tree. Because we don't have to pass context down as a prop, we greatly reduced the number of components rerendered. (I will be working on reducing the render time for workspace panel as this seems to still be a bottleneck point)