diff --git a/packages/dnb-eufemia/src/shared/hooks/__tests__/usePropsWithContext.test.ts b/packages/dnb-eufemia/src/shared/hooks/__tests__/usePropsWithContext.test.ts index 56d2a07b994..c0990166010 100644 --- a/packages/dnb-eufemia/src/shared/hooks/__tests__/usePropsWithContext.test.ts +++ b/packages/dnb-eufemia/src/shared/hooks/__tests__/usePropsWithContext.test.ts @@ -40,7 +40,7 @@ describe('usePropsWithContext', () => { prop2: 'prop2', a: 'a', b: 'b', - // c: 'c', // but not c + c: 'c', }) }) diff --git a/packages/dnb-eufemia/src/shared/hooks/usePropsWithContext.ts b/packages/dnb-eufemia/src/shared/hooks/usePropsWithContext.ts index 3de78d1f186..1cbe16f6beb 100644 --- a/packages/dnb-eufemia/src/shared/hooks/usePropsWithContext.ts +++ b/packages/dnb-eufemia/src/shared/hooks/usePropsWithContext.ts @@ -27,12 +27,8 @@ function usePropsWithContext( return { ...props, ...Object.entries(context).reduce((acc, [key, value]) => { - if ( - // check if a prop of the same name exists - typeof props[key] !== 'undefined' && - // and if it was NOT defined as a component prop, because its still the same as the defaults - props[key] === defaults[key] - ) { + // if it was NOT defined as a component prop, because its still the same as the defaults + if (props[key] === defaults[key]) { // then we use the context value acc[key] = value }