Skip to content

Commit

Permalink
Merge branch 'master' into feat/dashboard-plugin-wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo authored Sep 20, 2024
2 parents e55b82f + 8549683 commit 6b3e34a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [26.8.4](https://github.com/dhis2/analytics/compare/v26.8.3...v26.8.4) (2024-09-12)


### Bug Fixes

* add translucent prop to CachedDataQueryProvider (DHIS2-18029) ([#1699](https://github.com/dhis2/analytics/issues/1699)) ([ae4dbe6](https://github.com/dhis2/analytics/commit/ae4dbe63add659b4a2d0c8aab543721b0a85ab60))

## [26.8.3](https://github.com/dhis2/analytics/compare/v26.8.2...v26.8.3) (2024-08-27)


### Bug Fixes

* compute subtotals/totals for boolean types (DHIS2-9155) ([#1696](https://github.com/dhis2/analytics/issues/1696)) ([3392d78](https://github.com/dhis2/analytics/commit/3392d783b51dd8715beb09b673e567580005a0a2))

## [26.8.2](https://github.com/dhis2/analytics/compare/v26.8.1...v26.8.2) (2024-08-27)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/analytics",
"version": "26.8.2",
"version": "26.8.4",
"main": "./build/cjs/index.js",
"module": "./build/es/index.js",
"exports": {
Expand Down
10 changes: 8 additions & 2 deletions src/components/CachedDataQueryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ import React, { createContext, useContext } from 'react'

const CachedDataQueryCtx = createContext({})

const CachedDataQueryProvider = ({ query, dataTransformation, children }) => {
const CachedDataQueryProvider = ({
query,
dataTransformation,
children,
translucent = true,
}) => {
const { data: rawData, ...rest } = useDataQuery(query)
const { error, loading } = rest
const data =
rawData && dataTransformation ? dataTransformation(rawData) : rawData

if (loading) {
return (
<Layer translucent>
<Layer translucent={translucent}>
<CenteredContent>
<CircularLoader />
</CenteredContent>
Expand Down Expand Up @@ -43,6 +48,7 @@ CachedDataQueryProvider.propTypes = {
children: PropTypes.node.isRequired,
query: PropTypes.object.isRequired,
dataTransformation: PropTypes.func,
translucent: PropTypes.bool,
}

const useCachedDataQuery = () => useContext(CachedDataQueryCtx)
Expand Down

0 comments on commit 6b3e34a

Please sign in to comment.