diff --git a/package.json b/package.json index fe86ac6338..aee963b742 100644 --- a/package.json +++ b/package.json @@ -168,7 +168,8 @@ "pnpm": { "patchedDependencies": { "sonner@1.5.0": "patches/sonner@1.5.0.patch", - "hono@4.4.7": "patches/hono@4.4.7.patch" + "hono@4.4.7": "patches/hono@4.4.7.patch", + "immer@10.1.1": "patches/immer@10.1.1.patch" } }, "simple-git-hooks": { diff --git a/patches/immer@10.1.1.patch b/patches/immer@10.1.1.patch new file mode 100644 index 0000000000..3dc945b48f --- /dev/null +++ b/patches/immer@10.1.1.patch @@ -0,0 +1,13 @@ +diff --git a/dist/immer.d.ts b/dist/immer.d.ts +index 2cb6cddda28d1fb226fc9dc5fc4b64ec7fc55a9c..161cf402a794712dc700c6b63c138622b0a3dc4c 100644 +--- a/dist/immer.d.ts ++++ b/dist/immer.d.ts +@@ -48,7 +48,7 @@ type PatchListener = (patches: Patch[], inversePatches: Patch[]) => void; + * Utility types + */ + type PatchesTuple = readonly [T, Patch[], Patch[]]; +-type ValidRecipeReturnType = State | void | undefined | (State extends undefined ? typeof NOTHING : never); ++export type ValidRecipeReturnType = State | void | undefined | (State extends undefined ? typeof NOTHING : never); + type ReturnTypeWithPatchesIfNeeded = UsePatches extends true ? PatchesTuple : State; + /** + * Core Producer inference diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4503f63959..b0e9026fb7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ patchedDependencies: hono@4.4.7: hash: ycbk46disqruhfjducp47b5fl4 path: patches/hono@4.4.7.patch + immer@10.1.1: + hash: og7mbnoo5vh43tjlw5rbmrdbvu + path: patches/immer@10.1.1.patch sonner@1.5.0: hash: 6s3tquyt5wnkqaogymn3mkivuq path: patches/sonner@1.5.0.patch @@ -186,7 +189,7 @@ importers: version: 6.2.1 immer: specifier: 10.1.1 - version: 10.1.1 + version: 10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu) jotai: specifier: 2.9.1 version: 2.9.1(@types/react@18.3.3)(react@18.3.1) @@ -288,7 +291,7 @@ importers: version: 3.23.8 zustand: specifier: 4.5.4 - version: 4.5.4(@types/react@18.3.3)(immer@10.1.1)(react@18.3.1) + version: 4.5.4(@types/react@18.3.3)(immer@10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu))(react@18.3.1) devDependencies: '@egoist/tailwindcss-icons': specifier: 1.8.1 @@ -11534,7 +11537,7 @@ snapshots: immediate@3.0.6: {} - immer@10.1.1: {} + immer@10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu): {} import-fresh@3.3.0: dependencies: @@ -13963,12 +13966,12 @@ snapshots: zod@3.23.8: {} - zustand@4.5.4(@types/react@18.3.3)(immer@10.1.1)(react@18.3.1): + zustand@4.5.4(@types/react@18.3.3)(immer@10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu))(react@18.3.1): dependencies: use-sync-external-store: 1.2.0(react@18.3.1) optionalDependencies: '@types/react': 18.3.3 - immer: 10.1.1 + immer: 10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu) react: 18.3.1 zwitch@2.0.4: {} diff --git a/src/renderer/src/lib/defineQuery.ts b/src/renderer/src/lib/defineQuery.ts index e32c9acf81..139f25e980 100644 --- a/src/renderer/src/lib/defineQuery.ts +++ b/src/renderer/src/lib/defineQuery.ts @@ -3,18 +3,11 @@ import type { QueryFunction, QueryKey, } from "@tanstack/react-query" -import type { Draft, nothing } from "immer" +import type { Draft, ValidRecipeReturnType } from "immer" import { produce } from "immer" import { queryClient } from "./query-client" -// From immer, but immer not export this type -type ValidRecipeReturnType = - | State - | void - | undefined - | (State extends undefined ? typeof nothing : never) - export type DefinedQuery = Readonly<{ key: TQueryKey fn: QueryFunction