diff --git a/packages/dnb-eufemia/src/components/date-picker/hooks/useLastEventCallCache.ts b/packages/dnb-eufemia/src/components/date-picker/hooks/useLastEventCallCache.ts index d75872d7218..b3d1e5cb079 100644 --- a/packages/dnb-eufemia/src/components/date-picker/hooks/useLastEventCallCache.ts +++ b/packages/dnb-eufemia/src/components/date-picker/hooks/useLastEventCallCache.ts @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react' +import { useState } from 'react' import { DatePickerDates } from './useDates' export type LastEventCallCache = { @@ -13,15 +13,13 @@ export default function useLastEventCallCache( ) { const [cache, setCache] = useState(undefined) - useEffect(() => { - if ( - cache && - (cache.startDate !== uncachedDates.startDate || - cache.endDate !== uncachedDates.endDate) - ) { - setCache(undefined) - } - }, [uncachedDates, cache]) + if ( + cache && + (cache.startDate !== uncachedDates.startDate || + cache.endDate !== uncachedDates.endDate) + ) { + setCache(undefined) + } return [cache, setCache] as const }