cube-js / cube-js/cube

Option to return `refreshKeyValue` when not in devMode or using Cube Playground

Open
#9,158 3 comments 4 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Is your feature request related to a problem? Please describe.**
The `refresh_key` value would be helpful for us to use on our frontend to display as a data freshness metric. It's available when running Cube locally but is removed in production:

```
const resObj = {
query: normalizedQuery,
lastRefreshTime: response.lastRefreshTime?.toISOString(),
...(
getEnv('devMode') ||
context.signedWithPlaygroundAuthSecret
? {
refreshKeyValues: response.refreshKeyValues,
usedPreAggregations: response.usedPreAggregations,
transformedQuery: sqlQuery.canUseTransformedQuery,
requestId: context.requestId,
}
: null
),
```

**Describe the solution you'd like**
Would it be possible to add a context variable that optionally allows key-value pairs from the conditionally included object to be returned in production?

**Describe alternatives you've considered**
This data can be retrieved via further queries from the frontend, but if many Cubes are being used to fetch data for a page, it introduces a lot more queries which are unnecessary when the data has already been retrieved but is being removed from the response.

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.