Cube.js: useCubeQuery requires a dimension to work

Created on 7 May 2020  路  4Comments  路  Source: cube-js/cube.js

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

  1. Make query with no dimension,
  2. pass query to useCubeQuery like this:

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.

question

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?

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings