Error when using package in react app
yianni-ververis opened this issue · 1 comments
I try to use this in a react template that I am building and even though I have no issue with the barchart and the linechart, with this, I get the following error
react_devtools_backend.js:2273 Error: Invalid stardust hook call. Hooks can only be called inside a visualization component. at getHook (stardust.dev.js:23037) at useInternalContext (stardust.dev.js:23071) at Object.useStaleLayout (stardust.dev.js:23475) at component (sn-mekko-chart.js:9) at stardust.js:20 at tryCatch (stardust.dev.js:298) at Generator.invoke [as _invoke] (stardust.dev.js:518) at Generator.prototype.<computed> [as next] (stardust.dev.js:351) at n (stardust.js:7) at l (stardust.js:7)
Here is my code
const update = async () => {
// Selections
const selections = await _GlobalsContext.nebula.selections();
selections.mount(vis1Ref.current);
// Barchart
_GlobalsContext.nebula.render({
element: vis2Ref.current,
type: 'mekkoChart',
properties: {
qHyperCubeDef: {
qDimensions: [
{ qDef: { qFieldDefs: ['Case Owner Group'] } },
{ qDef: { qFieldDefs: ['Priority'] } },
],
qMeasures: [
{ qDef: { qDef: 'Count([Case Is Closed])' } },
],
},
},
});
};
I forked the repo and trying to investigate further