diff --git a/packages/ui-react-utils/src/DeterministicIdContext/DeterministicIdContext.ts b/packages/ui-react-utils/src/DeterministicIdContext/DeterministicIdContext.ts index 4ab89b0412..1d4b65eee4 100644 --- a/packages/ui-react-utils/src/DeterministicIdContext/DeterministicIdContext.ts +++ b/packages/ui-react-utils/src/DeterministicIdContext/DeterministicIdContext.ts @@ -24,6 +24,7 @@ import React from 'react' import { generateInstanceCounterMap } from './generateInstanceCounterMap' -const DeterministicIdContext = React.createContext(generateInstanceCounterMap()) +const defaultDeterministicIDMap = generateInstanceCounterMap() +const DeterministicIdContext = React.createContext(defaultDeterministicIDMap) -export { DeterministicIdContext } +export { DeterministicIdContext, defaultDeterministicIDMap } diff --git a/packages/ui-react-utils/src/DeterministicIdContext/DeterministicIdContextProvider.tsx b/packages/ui-react-utils/src/DeterministicIdContext/DeterministicIdContextProvider.tsx index 71e2f3b1f6..813d0fa1cf 100644 --- a/packages/ui-react-utils/src/DeterministicIdContext/DeterministicIdContextProvider.tsx +++ b/packages/ui-react-utils/src/DeterministicIdContext/DeterministicIdContextProvider.tsx @@ -22,15 +22,16 @@ * SOFTWARE. */ import React from 'react' -import { generateInstanceCounterMap } from './generateInstanceCounterMap' -import { DeterministicIdContext } from './DeterministicIdContext' +import { + DeterministicIdContext, + defaultDeterministicIDMap +} from './DeterministicIdContext' + type DeterministicIdProviderValue = Map type DeterministicIdProviderProps = React.PropsWithChildren<{ instanceCounterMap?: DeterministicIdProviderValue }> -const defaultContextValue = generateInstanceCounterMap() - /** * --- * category: components/utilities @@ -50,7 +51,7 @@ const DeterministicIdContextProvider = ({ ) } DeterministicIdContextProvider.defaultProps = { - instanceCounterMap: defaultContextValue + instanceCounterMap: defaultDeterministicIDMap } export { DeterministicIdContextProvider }