Skip to content

Commit

Permalink
Merge branch 'master' into fix/pt-totals
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenrikoverland authored Sep 13, 2024
2 parents 6969291 + 8549683 commit af2b894
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [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)


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.3",
"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 af2b894

Please sign in to comment.