From 82ced0f10108dbff639f5dc964438c7292bae7de Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Thu, 20 Feb 2025 17:25:47 +0100 Subject: [PATCH] fix: don't rerender function --- components/settings/StorageSettings.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/settings/StorageSettings.tsx b/components/settings/StorageSettings.tsx index 5ca3b229..9dbb4bc5 100644 --- a/components/settings/StorageSettings.tsx +++ b/components/settings/StorageSettings.tsx @@ -10,6 +10,7 @@ import { ListItem } from "../list/ListItem"; import { useTranslation } from "react-i18next"; import { storage } from "@/utils/mmkv"; import { RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY } from "@/utils/recently-added-notifications"; +import { useCallback } from "react"; export const StorageSettings = () => { const { deleteAllFiles, appSizeUsage } = useDownload(); @@ -43,6 +44,10 @@ export const StorageSettings = () => { return ((value / total) * 100).toFixed(2); }; + const clearRecentlyAddedNotifications = useCallback(() => { + storage.delete(RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY); + }, []); + return ( @@ -114,9 +119,7 @@ export const StorageSettings = () => { { - storage.set(RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY, "[]"); - }} + onPress={clearRecentlyAddedNotifications} title={"Reset recently added notifications"} />