diff --git a/src/app/pages/Home/OtherComponents/Tokens/AcceptAdsBanner.tsx b/src/app/pages/Home/OtherComponents/Tokens/AcceptAdsBanner.tsx index 7862170535..d43fa5b2d9 100644 --- a/src/app/pages/Home/OtherComponents/Tokens/AcceptAdsBanner.tsx +++ b/src/app/pages/Home/OtherComponents/Tokens/AcceptAdsBanner.tsx @@ -3,7 +3,6 @@ import React, { FC, useCallback, useMemo } from 'react'; import { useDispatch } from 'react-redux'; import { Banner, BannerButtonProps } from 'app/atoms/Banner'; -import { useUserAnalyticsAndAdsSettings } from 'app/hooks/use-user-analytics-and-ads-settings.hook'; import { togglePartnersPromotionAction } from 'app/store/partners-promotion/actions'; import { setAdsBannerVisibilityAction } from 'app/store/settings/actions'; import { T } from 'lib/i18n'; @@ -14,7 +13,6 @@ import { AssetsSelectors } from '../Assets.selectors'; export const AcceptAdsBanner: FC = () => { const dispatch = useDispatch(); - useUserAnalyticsAndAdsSettings(); const onEnableButtonClick = useCallback(() => { dispatch(togglePartnersPromotionAction(true)); dispatch(setAdsBannerVisibilityAction(false)); diff --git a/src/lib/temple/front/storage.ts b/src/lib/temple/front/storage.ts index 7b6b7089d4..15e49ff00b 100644 --- a/src/lib/temple/front/storage.ts +++ b/src/lib/temple/front/storage.ts @@ -47,17 +47,16 @@ export function usePassiveStorage(key: string, fallback?: T) { setValue(finalData); }, [finalData]); - const prevValue = useRef(value); - - useEffect(() => { - if (prevValue.current !== value && value !== undefined) { - putToStorage(key, value); - } - - prevValue.current = value; - }, [key, value]); + const updateValue = useCallback( + (newValue: T | null | undefined) => { + const newValueWithFallback = fallback === undefined ? newValue : newValue ?? fallback; + putToStorage(key, newValueWithFallback); + setValue(newValueWithFallback); + }, + [fallback, key] + ); - return [value, setValue]; + return [value, updateValue]; } function onStorageChanged(key: string, callback: (newValue: T) => void) {