From c27665df92cf007600f710a108cfa2edaef9b5c2 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 18 Nov 2024 12:13:25 +0800 Subject: [PATCH] fix: action does not take effect after saving close #1600 --- apps/renderer/src/modules/settings/tabs/actions/index.tsx | 4 ++++ apps/renderer/src/store/entry/store.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/apps/renderer/src/modules/settings/tabs/actions/index.tsx b/apps/renderer/src/modules/settings/tabs/actions/index.tsx index 2dfc2f500d..94050f35b1 100644 --- a/apps/renderer/src/modules/settings/tabs/actions/index.tsx +++ b/apps/renderer/src/modules/settings/tabs/actions/index.tsx @@ -9,6 +9,7 @@ import { toast } from "sonner" import { useAuthQuery } from "~/hooks/common" import { apiClient } from "~/lib/api-fetch" import { toastFetchError } from "~/lib/error-parser" +import { queryClient } from "~/lib/query-client" import { ActionCard } from "~/modules/settings/action-card" import { Queries } from "~/queries" @@ -57,6 +58,9 @@ export const ActionSetting = () => { }, onSuccess: () => { Queries.action.getAll().invalidate() + queryClient.invalidateQueries({ + queryKey: ["entries"], + }) toast(t("actions.saveSuccess")) }, onError: (error) => { diff --git a/apps/renderer/src/store/entry/store.ts b/apps/renderer/src/store/entry/store.ts index 4ca0eac631..855cf7be6e 100644 --- a/apps/renderer/src/store/entry/store.ts +++ b/apps/renderer/src/store/entry/store.ts @@ -256,6 +256,9 @@ class EntryActions { state.flatMapEntries[item.entries.id]?.entries || {}, item.entries, ) + if (item.settings) { + draft.flatMapEntries[item.entries.id].settings = item.settings + } // Is related to feed if (item.feeds) {