You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We're giving Discover a visual refresh, and part of this is redesigning the toolbar of EuiDataGrid in a significant way. It should allow the rendering on the number of documents on the left side of the toolbar, move all other elements on the right side, change the appearance, change at least 1 icon, make one popover extensible.
Describe the solution you'd like
Chatting about this use case @cee-chen suggested to use render props for that, and drafted:
A solution like this would be very flexible and we could implement all desired changes in Discover.
Describe alternatives you've considered @kertal first thought to solve it via adding more configuration properties, but the render props solution is much much better.
Desired timeline
Kibana 8.11 would be great 🙈 , In Kibana 8.12 we would need to apply these changes, so early 8.12 would also work ❤️
Additional context
This is how it how should look like in Discover:
Architecturally I think the biggest thing to explore with the snippet in the PR is passing back React nodes or React components, i.e. <ColumnsControlButton /> as opposed to {columnsControlButton}.
I'd like to investigate how feasible passing back configurable components instead of raw nodes would be, as that would allow extra consumer configuration (e.g. allowing consumers to pass CSS/styles props directly to buttons as opposed to needing a wrapper, that kind of thing). I'm planning on spiking that out today/tomorrow as part of my support week.
I poked around a bit re: returning a React component from our various hooks and eventually decided against it - let's stick to returning React nodes/JSX for now (since it's significantly simpler as that's already the current architecture).
[The below is mostly some long rambling thoughts on my research around the topic and why I eventually decided against it, feel free to skip until after the next break]
When I did a bit of googling around the interwebs, there is one helpful article on returning components from hooks that mentions "you can do it, but the component ends up fully unmounting/remounting whenever dependent props change" and eventually just kinda concludes with "so in the end it's better to define the component statically and use context instead" 😅 which is totally valid, and context is great, but EuiDataGrid kind of already has a lot of context (3 providers at the top level of the grid already). TBH, on that subject, I've often wondered if we should redo the entire top-level data_grid.tsx and have it just be like 10 or so providers, so we can avoid the current painful waterfall of a million passed props down to every child/grandchild component. It's an interesting thought, but probably not a refactor worth doing just for this one feature request.
In summary, I think we'd need a really compelling reason to make the architectural changes necessary to pass back components for every toolbar control. Right now I'm not seeing a compelling enough reason to overhaul our architecture to do so, but if there is a strong enough reason in the future, it might be worth re-investigating then.
I took a quick peek at the merged PR and a quick comment I have there is I'd like the conditional if renderCustomToolbar exists, use the render prop logic to live within the data_grid_toolbar.tsx file instead of being called in the top level data_grid.tsx. We can just pass renderCustomToolbar as a prop down to the <EuiDataGridToolbar> component instead (will be much easier to unit test that way tbh).
Activity
cee-chen commentedon Sep 7, 2023
Architecturally I think the biggest thing to explore with the snippet in the PR is passing back React nodes or React components, i.e.
<ColumnsControlButton />as opposed to{columnsControlButton}.I'd like to investigate how feasible passing back configurable components instead of raw nodes would be, as that would allow extra consumer configuration (e.g. allowing consumers to pass CSS/styles props directly to buttons as opposed to needing a wrapper, that kind of thing). I'm planning on spiking that out today/tomorrow as part of my support week.
cee-chen commentedon Sep 11, 2023
I poked around a bit re: returning a React component from our various hooks and eventually decided against it - let's stick to returning React nodes/JSX for now (since it's significantly simpler as that's already the current architecture).
[The below is mostly some long rambling thoughts on my research around the topic and why I eventually decided against it, feel free to skip until after the next break]
When I did a bit of googling around the interwebs, there is one helpful article on returning components from hooks that mentions "you can do it, but the component ends up fully unmounting/remounting whenever dependent props change" and eventually just kinda concludes with "so in the end it's better to define the component statically and use context instead" 😅 which is totally valid, and context is great, but EuiDataGrid kind of already has a lot of context (3 providers at the top level of the grid already). TBH, on that subject, I've often wondered if we should redo the entire top-level
data_grid.tsxand have it just be like 10 or so providers, so we can avoid the current painful waterfall of a million passed props down to every child/grandchild component. It's an interesting thought, but probably not a refactor worth doing just for this one feature request.In summary, I think we'd need a really compelling reason to make the architectural changes necessary to pass back components for every toolbar control. Right now I'm not seeing a compelling enough reason to overhaul our architecture to do so, but if there is a strong enough reason in the future, it might be worth re-investigating then.
I took a quick peek at the merged PR and a quick comment I have there is I'd like the conditional
if renderCustomToolbar exists, use the render proplogic to live within thedata_grid_toolbar.tsxfile instead of being called in the top leveldata_grid.tsx. We can just passrenderCustomToolbaras a prop down to the<EuiDataGridToolbar>component instead (will be much easier to unit test that way tbh).kertal commentedon Sep 11, 2023
@cee-chen thx for your feedback 👍