From a060986fa3107f8f5e050b430787014dd9bbdc10 Mon Sep 17 00:00:00 2001 From: Stephen Zhou Date: Sun, 29 Sep 2024 10:23:01 +0800 Subject: [PATCH] fix: reset feed search, close #701 --- apps/renderer/src/modules/settings/tabs/lists.tsx | 6 +++++- apps/renderer/src/store/feed/hooks.ts | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/renderer/src/modules/settings/tabs/lists.tsx b/apps/renderer/src/modules/settings/tabs/lists.tsx index 4b0e86fc1..14eb31f6d 100644 --- a/apps/renderer/src/modules/settings/tabs/lists.tsx +++ b/apps/renderer/src/modules/settings/tabs/lists.tsx @@ -345,7 +345,11 @@ export const ListFeedsModalContent = ({ id }: { id: string }) => { const { t } = useTranslation("settings") const [feedSearchFor, setFeedSearchFor] = useState("") - const addMutation = useAddFeedToFeedList() + const addMutation = useAddFeedToFeedList({ + onSuccess: () => { + setFeedSearchFor("") + }, + }) const allFeeds = useSubscriptionStore((store) => { const feedInfo = [] as { title: string; id: string }[] diff --git a/apps/renderer/src/store/feed/hooks.ts b/apps/renderer/src/store/feed/hooks.ts index 726c58975..092eb9439 100644 --- a/apps/renderer/src/store/feed/hooks.ts +++ b/apps/renderer/src/store/feed/hooks.ts @@ -62,7 +62,10 @@ export const useFeedHeaderTitle = () => { } } -export const useAddFeedToFeedList = (options?: { onSuccess: () => void; onError: () => void }) => { +export const useAddFeedToFeedList = (options?: { + onSuccess?: () => void + onError?: () => void +}) => { const { t } = useTranslation("settings") return useMutation({ mutationFn: async (