cube-js / cube-js/cube

useCubeQuery returns stale result even if resetResultSetOnChange is set

Open
#5,289 5 comments 2 reactions 0 assignees View on GitHub
client:core help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**
Changing the query passed to useCubeQuery causes the latter to return the old value even if `resetResultSetOnChange` is set to `true`

**To Reproduce**
Steps to reproduce the behavior:
1. Create some query and pass it to useCubeQuery, then log both the query and the results, something like this
```
const result = useCubeQuery(query, { resetResultSetOnChange: true })

console.log('Test query: ', query)
console.log('Test result: ', result)
```

2. Change the query in any way, eg. user interaction
3. See logs

**Expected behavior**
I expect the resultSet to be null if the passed query has changed (I guess `isLoading` should be `true`, either)

**Screenshots**
You can see from the following screenshot that even though the query changed (there's a filter in the second one), the returned resultSet is the same (actually the whole object is the same), then after a third render the result is the one expected (last two lines).

![image](https://user-images.githubusercontent.com/12485857/189887743-00478dfb-f449-4ebf-b099-076127926d7e.png)

**Version:**
0.30.64

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.