11// Libraries
2- import React , { FC , createContext , useEffect , useMemo , useRef } from 'react'
2+ import React , {
3+ FC ,
4+ createContext ,
5+ useEffect ,
6+ useMemo ,
7+ useRef ,
8+ useContext ,
9+ } from 'react'
310import { useDispatch } from 'react-redux'
411import { createLocalStorageStateHook } from 'use-local-storage-state'
512import { normalize } from 'normalizr'
@@ -18,6 +25,7 @@ import {
1825// Types
1926import { Bucket , BucketEntities , RemoteDataState } from 'src/types'
2027import { QueryScope } from 'src/types/flows'
28+ import { PipeContext } from 'src/flows/context/pipe'
2129
2230let MeasurementSchemaCreateRequest = null
2331if ( CLOUD ) {
@@ -56,6 +64,7 @@ interface Props {
5664export const BucketProvider : FC < Props > = ( { children, scope} ) => {
5765 const cacheKey = `${ scope . region } ;;<${ scope . org } >`
5866 const [ bucketCache , setBucketCache ] = useLocalStorageState ( )
67+ const { data} = useContext ( PipeContext )
5968 const dispatch = useDispatch ( )
6069 const buckets = bucketCache [ cacheKey ] ?. buckets ?? [ ]
6170 const lastFetch = bucketCache [ cacheKey ] ?. lastFetch ?? 0
@@ -309,6 +318,6 @@ export const BucketProvider: FC<Props> = ({children, scope}) => {
309318 { children }
310319 </ BucketContext . Provider >
311320 ) ,
312- [ loading , buckets ]
321+ [ data . bucket , loading , buckets ]
313322 )
314323}
0 commit comments