Skip to content

Commit

Permalink
fix: add translucent prop to CachedDataQueryProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
BRaimbault committed Sep 10, 2024
1 parent 66cd146 commit ac256b6
Showing 1 changed file with 8 additions and 2 deletions.
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 ac256b6

Please sign in to comment.