Simon Lejeune
11/06/2023, 3:33 PMuseDispatchDashboardCommand
to interact with a dashboard embed but i'm always faced with the following traceback:
Cannot read properties of null (reading 'store')
TypeError: Cannot read properties of null (reading 'store')
at useStore (<http://localhost:3000/static/js/vendors-node_modules_mui_material_ListItemButton_ListItemButton_js-node_modules_react-redux_e-57d794.chunk.js:1482:32>)
at useDispatch (<http://localhost:3000/static/js/vendors-node_modules_mui_material_ListItemButton_ListItemButton_js-node_modules_react-redux_e-57d794.chunk.js:1219:17>)
at useDispatchDashboardCommand (<http://localhost:3000/static/js/vendors-node_modules_mui_icons-material_AssignmentIndRounded_js-node_modules_mui_icons-materi-c61b61.chunk.js:328685:100>)
this is the kind of line triggering the issue:
import {
resetAttributeFilterSelection,
useDispatchDashboardCommand,
} from "@gooddata/sdk-ui-dashboard";
[...]
const resetAttributeFilter = useDispatchDashboardCommand(resetAttributeFilterSelection);
As soon as this line is hit, the traceback happens. Is there some kind of prerequisite i'm missing?
our dependencies are the following:
"@gooddata/sdk-backend-tiger": "^9.3.0",
"@gooddata/sdk-ui-dashboard": "^9.3.0",
and it is also failing with 9.1.0.
Thanks in advanceRadek Novacek
11/06/2023, 3:55 PMSimon Lejeune
11/07/2023, 9:38 AMSimon Lejeune
11/08/2023, 9:41 AMRadek Novacek
11/08/2023, 12:07 PMSimon Lejeune
11/16/2023, 9:34 AMRadek Novacek
11/16/2023, 9:37 AMSimon Lejeune
11/16/2023, 9:51 AMuseDispatchDashboardCommand
.
The error raised as shown here is related to a missing store and some places in the gooddata-ui-sdk source seem to refer to an extra react-redux store that needs to be explciitely passed, but I'm unsure and can't find any working example. If you could get some dev's input on the subject that would be very valuable to me 🙏Radek Novacek
11/20/2023, 10:14 AMCannot read properties of null (reading 'store')
error is coming from the fact that that calling useDispatchDashboardCommand
runs useDashboardDispatch
(from DashboardStoreProvider.tsx), and that comes back with a null value for the store because it's missing the necessary context - either a dashboard, workspace, backend, so on.
Fortunately for both of us 🙂, we do actually have an annotated working example of a Dashboard component with the use of dispatch commands! It's available here: Component library. I would absolutely recommend bookmarking this site, this is what I tend to refer to for a lot of customer use-cases as well.
Hope the above helps! 🤞Simon Lejeune
11/20/2023, 2:25 PMRadek Novacek
11/20/2023, 2:26 PM