Bastien Dewerse
12/29/2023, 1:47 PMCustomWidget
provided to a Dashboard) React component to a Dashboard in order to get its state (and more precisely the layout.section
part).
I've managed to make it works using the Dashboard's props onStateChange
but there's a remark in the method description:
> @remarks
> Note: there is no need to use this in your own React components that you plug into the dashboard. Your React component code can use @gooddata/sdk-ui-dashboard#useDashboardSelector and @gooddata/sdk-ui-dashboard#useDashboardDispatch hooks instead.
I've tried to use both as the SDK implies, but as far as I can tell, I can only use useDashboardDispatch
inside a CustomWidget
passed to a Dashboard because the method needs to access the Dashboard store.
Now the questions are:
1. Is there any way to separate the store from the dashboard component so we can add React stuff in between?
2. Is there another way to properly get a dashboard state?
3. If not, the useDashboardDispatch
is triggered a lot of time through a dashboard loading, so is there a cleaner way to get the layout
only once it's fully load or do I have to reset to check the layout existence in the onStateChange
each time it's fired?
4. There's a SidebarComponent
props in the Dashboard but as far I tried, it add a bar at the top of the dashboard. Considering I'm trying to bind the dashboard layout.sections
to a vertical menu, would I be better to pass a React component to that props instead of trying to extract the state?Radek Novacek
12/29/2023, 4:44 PMRadek Novacek
01/15/2024, 12:55 PMRadek Novacek
01/16/2024, 9:57 AMBastien Dewerse
01/16/2024, 10:24 AM