@@ -29,11 +29,7 @@ export interface MutationState<
29
29
TVariables = unknown ,
30
30
TOnMutateResult = unknown ,
31
31
> {
32
- /**
33
- * @deprecated `context` was renamed to `scope`. This will be removed in the next major version. Use the `scope` property instead.
34
- */
35
32
context : TOnMutateResult | undefined
36
- scope : TOnMutateResult | undefined
37
33
data : TData | undefined
38
34
error : TError | null
39
35
failureCount : number
@@ -54,7 +50,7 @@ interface PendingAction<TVariables, TOnMutateResult> {
54
50
type : 'pending'
55
51
isPaused : boolean
56
52
variables ?: TVariables
57
- scope ?: TOnMutateResult
53
+ context ?: TOnMutateResult
58
54
}
59
55
60
56
interface SuccessAction < TData > {
@@ -221,14 +217,14 @@ export class Mutation<
221
217
this as Mutation < unknown , unknown , unknown , unknown > ,
222
218
mutationFnContext ,
223
219
)
224
- const scope = await this . options . onMutate ?.(
220
+ const context = await this . options . onMutate ?.(
225
221
variables ,
226
222
mutationFnContext ,
227
223
)
228
- if ( scope !== this . state . scope ) {
224
+ if ( context !== this . state . context ) {
229
225
this . #dispatch( {
230
226
type : 'pending' ,
231
- scope ,
227
+ context ,
232
228
variables,
233
229
isPaused,
234
230
} )
@@ -240,15 +236,15 @@ export class Mutation<
240
236
await this . #mutationCache. config . onSuccess ?.(
241
237
data ,
242
238
variables ,
243
- this . state . scope ,
239
+ this . state . context ,
244
240
this as Mutation < unknown , unknown , unknown , unknown > ,
245
241
mutationFnContext ,
246
242
)
247
243
248
244
await this . options . onSuccess ?.(
249
245
data ,
250
246
variables ,
251
- this . state . scope ,
247
+ this . state . context ,
252
248
mutationFnContext ,
253
249
)
254
250
@@ -257,7 +253,7 @@ export class Mutation<
257
253
data ,
258
254
null ,
259
255
this . state . variables ,
260
- this . state . scope ,
256
+ this . state . context ,
261
257
this as Mutation < unknown , unknown , unknown , unknown > ,
262
258
mutationFnContext ,
263
259
)
@@ -266,7 +262,7 @@ export class Mutation<
266
262
data ,
267
263
null ,
268
264
variables ,
269
- this . state . scope ,
265
+ this . state . context ,
270
266
mutationFnContext ,
271
267
)
272
268
@@ -278,15 +274,15 @@ export class Mutation<
278
274
await this . #mutationCache. config . onError ?.(
279
275
error as any ,
280
276
variables ,
281
- this . state . scope ,
277
+ this . state . context ,
282
278
this as Mutation < unknown , unknown , unknown , unknown > ,
283
279
mutationFnContext ,
284
280
)
285
281
286
282
await this . options . onError ?.(
287
283
error as TError ,
288
284
variables ,
289
- this . state . scope ,
285
+ this . state . context ,
290
286
mutationFnContext ,
291
287
)
292
288
@@ -295,7 +291,7 @@ export class Mutation<
295
291
undefined ,
296
292
error as any ,
297
293
this . state . variables ,
298
- this . state . scope ,
294
+ this . state . context ,
299
295
this as Mutation < unknown , unknown , unknown , unknown > ,
300
296
mutationFnContext ,
301
297
)
@@ -304,7 +300,7 @@ export class Mutation<
304
300
undefined ,
305
301
error as TError ,
306
302
variables ,
307
- this . state . scope ,
303
+ this . state . context ,
308
304
mutationFnContext ,
309
305
)
310
306
throw error
@@ -340,8 +336,7 @@ export class Mutation<
340
336
case 'pending' :
341
337
return {
342
338
...state ,
343
- context : action . scope ,
344
- scope : action . scope ,
339
+ context : action . context ,
345
340
data : undefined ,
346
341
failureCount : 0 ,
347
342
failureReason : null ,
@@ -396,7 +391,6 @@ export function getDefaultState<
396
391
> ( ) : MutationState < TData , TError , TVariables , TOnMutateResult > {
397
392
return {
398
393
context : undefined ,
399
- scope : undefined ,
400
394
data : undefined ,
401
395
error : null ,
402
396
failureCount : 0 ,
0 commit comments