-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lens] Remove <NativeRenderer /> (#161521)
## Summary The NativeRenderer component is currently used to mount another component in a separate mounting point. As far as I recall, we introduced <NativeRenderer/> 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: 1. 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. 2. 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. 3. 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: 1. Setting up non-React visualization or data source code might become slightly more complex. Performance improvement for drag and drop action with these changes: before: <img width="1110" alt="Screenshot 2023-07-10 at 07 14 39" src="https://github.com/elastic/kibana/assets/4283304/45a1b09b-5189-46f5-af2b-7781fcf4e774"> after: <img width="1117" alt="Screenshot 2023-07-10 at 07 16 24" src="https://github.com/elastic/kibana/assets/4283304/0e704da1-3220-4eb9-8fa0-cc3584a90090"> ## 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) <img width="1117" alt="Screenshot 2023-07-10 at 07 16 24" src="https://github.com/elastic/kibana/assets/4283304/6d7f2d9f-a758-476e-8efb-38693ae90097"> 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) <img width="732" alt="Screenshot 2023-07-10 at 14 52 41" src="https://github.com/elastic/kibana/assets/4283304/03ec97b3-8225-490e-8884-0fd4e69587e8"> --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
5d06694
commit 95e5087
Showing
33 changed files
with
424 additions
and
1,196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,6 @@ | |
"developerExamples", | ||
"expressions", | ||
"fieldFormats" | ||
], | ||
"requiredBundles": [ | ||
"kibanaReact" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.