cube-js/cube

[cubejs-client-react] `useCubeQuery` `isLoading` is always true for empty query

Open

#9,985 opened on Sep 22, 2025

View on GitHub
 (3 comments) (1 reaction) (0 assignees)Rust (1,965 forks)batch import
client:reacthelp wanted

Repository metrics

Stars
 (19,563 stars)
PR merge metrics
 (Avg merge 4d 17h) (136 merged PRs in 30d)

Description

Describe the bug isLoading for useCubeQuery is forever true if the query is empty.

To Reproduce

  1. Use useCubeQuery to send a query that is empty (empty lists for dimensions, measures, etc)
  2. Notice isLoading is always set to true

In the sandbox, notice how it's forever "Loading...". And the console logs isLoading as true too, even though the request finished long ago.

In the code:

The default value for isLoading on L12 is the same as the opposite of the skip option. Then the isQueryPresent check for empty query skips everything else so isLoading is never updated again.

Expected behavior isLoading should be false as soon as the request finishes/never been fired, whether the query was empty or not.

Minimally reproducible Cube Schema

N/A

Version: Noticed on the latest 1.2, but seems like it's been there since 1.1

Additional context Add any other context about the problem here.

Contributor guide