Describe the bug
useCubeQuery from @cubejs-client/react throws an error "cannot read property "split" of undefined" when you give it a query with either no dimensions or an empty array for dimensions.
To Reproduce
const renderProps = query ? useCubeQuery(query, { subscribe: true }) : {};
observe error.
Expected behavior
Should query fine just like it does when you make a manual request.
Version:
"@cubejs-client/core": "^0.17.10",
"@cubejs-client/react": "^0.17.10",
"@cubejs-client/ws-transport": "^0.17.10",
Additional context
I was forced to add a meaningless dimension to my query that I don't need, to get it to work.
My measure gives me all the data I want.
Also. happens on latest version 0.19.16
Hey @MarkLyck ! Thanks for posting this! Interesting. Could you please check 0.19.15?
@MarkLyck BTW hook can't be under conditional statement like ternary operator or if. You should see react warnings about that. Could you please also share full stack trace?
Turns out it was a Presto error in our multitenacy code, and not from useCubeQuery.
My bad.
Most helpful comment
@MarkLyck BTW hook can't be under conditional statement like ternary operator or
if. You should see react warnings about that. Could you please also share full stack trace?