Skip to content

Commit 9f6c992

Browse files
author
Sunil Hari
authored
fix(types): change types for useMutation context in onSuccess (#3654)
changes context to optional in onSuccess callback
1 parent 5848fab commit 9f6c992

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/core/mutation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export class Mutation<
178178
this.options.onSuccess?.(
179179
data,
180180
this.state.variables!,
181-
this.state.context!
181+
this.state.context
182182
)
183183
)
184184
.then(() =>

src/core/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ export interface MutationOptions<
548548
onSuccess?: (
549549
data: TData,
550550
variables: TVariables,
551-
context: TContext
551+
context: TContext | undefined
552552
) => Promise<unknown> | void
553553
onError?: (
554554
error: TError,

0 commit comments

Comments
 (0)