Skip to content

Commit

Permalink
fix: action does not take effect after saving
Browse files Browse the repository at this point in the history
close #1600
  • Loading branch information
hyoban committed Nov 18, 2024
1 parent 8b9750d commit c27665d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/renderer/src/modules/settings/tabs/actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -57,6 +58,9 @@ export const ActionSetting = () => {
},
onSuccess: () => {
Queries.action.getAll().invalidate()
queryClient.invalidateQueries({
queryKey: ["entries"],
})
toast(t("actions.saveSuccess"))
},
onError: (error) => {
Expand Down
3 changes: 3 additions & 0 deletions apps/renderer/src/store/entry/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check failure on line 260 in apps/renderer/src/store/entry/store.ts

View workflow job for this annotation

GitHub Actions / Format, Lint and Typecheck (lts/*)

src/services/entry.spec.ts > Entry Service > assert data is ready

TypeError: Cannot set properties of undefined (setting 'settings') ❯ src/store/entry/store.ts:260:51 ❯ Module.Immer2.produce ../../node_modules/immer/src/core/immerClass.ts:97:14 ❯ src/store/entry/store.ts:252:7 ❯ setState ../../node_modules/zustand/esm/vanilla.mjs:5:55 ❯ EntryActions.upsertMany src/store/entry/store.ts:251:5 ❯ src/services/entry.spec.ts:19:18

Check failure on line 260 in apps/renderer/src/store/entry/store.ts

View workflow job for this annotation

GitHub Actions / Format, Lint and Typecheck (lts/*)

src/services/entry.spec.ts > Entry Service > delete entry

TypeError: Cannot set properties of undefined (setting 'settings') ❯ src/store/entry/store.ts:260:51 ❯ Module.Immer2.produce ../../node_modules/immer/src/core/immerClass.ts:97:14 ❯ src/store/entry/store.ts:252:7 ❯ setState ../../node_modules/zustand/esm/vanilla.mjs:5:55 ❯ EntryActions.upsertMany src/store/entry/store.ts:251:5 ❯ src/services/entry.spec.ts:19:18

Check failure on line 260 in apps/renderer/src/store/entry/store.ts

View workflow job for this annotation

GitHub Actions / Format, Lint and Typecheck (lts/*)

src/services/entry.spec.ts > Entry Service > delete by feed id

TypeError: Cannot set properties of undefined (setting 'settings') ❯ src/store/entry/store.ts:260:51 ❯ Module.Immer2.produce ../../node_modules/immer/src/core/immerClass.ts:97:14 ❯ src/store/entry/store.ts:252:7 ❯ setState ../../node_modules/zustand/esm/vanilla.mjs:5:55 ❯ EntryActions.upsertMany src/store/entry/store.ts:251:5 ❯ src/services/entry.spec.ts:19:18
}

// Is related to feed
if (item.feeds) {
Expand Down

0 comments on commit c27665d

Please sign in to comment.