1# notable changes in React Mutation
2
3## v4
4
5### breaking
6
7- rewrite the api types to be cleaner. likely does not break most users.
8
9## v3.0.4
10
11### bugfixes
12
13- resolve a failed call replaying the optimistic helper restores of an earlier
14 call on the same key that had succeeded, putting back the value from before
15 the confirmed write
16- resolve a successful call that also used optimistic helpers retiring another
17 call's `onRestore` callbacks instead of its own
18- resolve helper updates not being rolled back when `optimistic` throws, when
19 `snapshot` skips a no-op call, or when a debounced call is superseded
20- resolve helpers refetching a query only for the first call on a key while a
21 `useMutate` stays subscribed to it
22- resolve a queued call's refetches running when the call ahead of it settled,
23 before its own write, which left the cache stale after both succeeded
24
25## v3.0.3
26
27### bugfixes
28
29- resolve calls made while a failed mutation refetches never running
30- resolve a synchronous throw from `mutate` escaping to the caller and leaving
31 the mutation stuck in its mutating state
32- resolve `useMutate` setting `isPending` after its mutation is swapped within
33 the 200ms pending delay
34- resolve `runWithOptions` (and so `MutationButton`) setting `isPending` and
35 disabling controls for debounced mutations, and leaving a pending delay from
36 an earlier `run` to set `isPending` later
37- resolve a debounced call made during an in-flight request running alongside
38 it, which let the first request mark the mutation idle mid-flight
39
40## v3.0.2
41
42### bugfixes
43
44- resolve `useMutate` leaving `isPending` stuck `true` when a mutation fails
45 within the 200ms pending delay
46
47## v3.0.1
48
49### bugfixes
50
51- resolve an SSR memory leak in `useMutate`
52- resolve `isAllowed`/`isDisabled` no longer updating after StrictMode's
53 simulated remount permanently dropped the subscription
54
55## v3
56
57### breaking
58
59- `id` is now required for all mutations. It must be unique per client;
60 duplicate registration throws in production and replaces the previous
61 registration in development (hot reload re-runs `define`).
62- `handleUnauthenticated` and `onUnauthenticated` now receive a serializable
63 `MutationAction` (`{ id, description, args }`) instead of a description string
64
65### features
66
67- authentication integration for mutations (`auth: true`, `userContext`,
68 `isAllowed`, `handleUnauthenticated`)
69- auth scopes for permission gates: declare `authScopes` on the client and
70 `auth: "<scope>"` on mutations
71- `MutationClient.run(action)` re-runs a stored `MutationAction`, enabling
72 sign-in flows that resume the blocked mutation
73- `MutationButton` hides non-allowed mutations that cannot route to the
74 sign-in flow; opt out with `showNotAllowed`
75
76### bugfixes
77
78- `runAsHeadlessPromise` correctly rethrows the underlying error
79- clarify some intent in the readme
80
81## v2.1.0
82
83### features
84
85- tanstack query integration
86 - arrayUpsert and objArrayUpsert
87- mutation buttons
88 - pass `args={null}` to disable the button UI
89
90## v2.0.1
91
92### bugfixes
93
94- typescript violation not passing client context to optimistic handlers
95- `onSuccess` prop split into `onSuccessUi` and `onSuccessData`. but it didn't even work before so this isn't breaking.
96
97## v2
98
99### breaking
100
101- rename `onSuccess` and `onSuccessDataOnly` to `onSuccessUi` and `onSuccessData`.
102
103## v1.1
104
105- Add `runAsHeadlessPromise`. The function name is intentionally long to avoid using it, please use `runWithOptions` instead.