From 08f4ba334a965b19c95aee5bcdc09667cf0b3d95 Mon Sep 17 00:00:00 2001 From: Michael Small Date: Tue, 24 Feb 2026 21:31:49 -0600 Subject: [PATCH] fix: assign properties of mutations in withMutation --- libs/ngrx-toolkit/src/lib/with-mutations.ts | 27 +++++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/libs/ngrx-toolkit/src/lib/with-mutations.ts b/libs/ngrx-toolkit/src/lib/with-mutations.ts index 5922307a..8586c1c5 100644 --- a/libs/ngrx-toolkit/src/lib/with-mutations.ts +++ b/libs/ngrx-toolkit/src/lib/with-mutations.ts @@ -118,14 +118,25 @@ function createMutationsFeature( keys.reduce( (acc, key) => ({ ...acc, - [key]: async (params: never) => { - const mutation = mutations[key]; - if (!mutation) { - throw new Error(`Mutation ${key} not found`); - } - const result = await mutation(params); - return result; - }, + [key]: Object.assign( + async (params: never) => { + const mutation = mutations[key]; + if (!mutation) { + throw new Error(`Mutation ${key} not found`); + } + const result = await mutation(params); + + return result; + }, + { + status: mutations[key].status, + value: mutations[key].value, + isPending: mutations[key].isPending, + isSuccess: mutations[key].isSuccess, + error: mutations[key].error, + hasValue: mutations[key].hasValue, + }, + ), }), {} as MethodsDictionary, ),