You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changed the global default for `resultObservable` from `'deep'` to `'ref'` for both `Query` and `Mutation`.
6
+
7
+
If your app relies on deep MobX tracking of nested fields inside query or mutation results, set `resultObservable: 'deep'` explicitly (locally or via `QueryClient` defaults).
Copy file name to clipboardExpand all lines: docs/api/Mutation.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,8 +179,9 @@ const mutation = new Mutation({
179
179
180
180
Chooses how MobX observes the mutation **`result`** property (the `MutationObserverResult`). The library applies `annotation.observable()` from [`yummies/mobx`](https://github.com/js2me/yummies). [`Query`](https://js2me.github.io/mobx-tanstack-query/api/Query.html#resultobservable-queryfeature) stores the payload on a private `_result` and exposes TanStack fields via getters; **`Mutation` decorates the public `result` field directly** — there is no `_result`.
181
181
182
-
-**Default** — when omitted, behaviour matches **`'deep'`** (deep observability for plain objects and arrays in the result).
182
+
-**Default** — when omitted, behaviour matches **`'ref'`** (only the result object reference is tracked).
183
183
-**`'ref'`** — only the reference to the result object is tracked; reactions run when the whole result is replaced, not when nested fields change in place.
184
+
-**`'deep'`** — deep observability for plain objects and arrays in the result.
184
185
-**`'shallow'`** / **`'struct'`** — shallow or structural comparison for nested properties.
185
186
-**`false`** — do not decorate `result` (rare; you lose automatic MobX tracking for the result blob).
186
187
@@ -216,10 +217,10 @@ Subscribe when mutation has been finished with failure
Mutation result (The same as returns the [`useMutation` hook](https://tanstack.com/query/latest/docs/framework/react/reference/useMutation))
222
223
223
-
::: info `observable.deep` is configurable
224
-
The badge reflects the **default**: the public `result` property is decorated as deep observable (unlike `Query`, which uses a private `_result` behind getters). Change the MobX flavour with [`resultObservable`](#resultobservable-mutationfeature) (`ref`, `shallow`, `struct`, `true`, or `false`).
224
+
::: info `observable.ref` is configurable
225
+
The badge reflects the **default**: the public `result` property is decorated as `observable.ref` (unlike `Query`, which uses a private `_result` behind getters). Change the MobX flavour with [`resultObservable`](#resultobservable-mutationfeature) (`deep`, `shallow`, `struct`, `true`, or `false`).
Query original result (The same as returns the [`useQuery` hook](https://tanstack.com/query/latest/docs/framework/react/reference/useQuery))
297
297
298
-
::: info `observable.deep` is configurable
299
-
The badge reflects the **default**: the internal `_result` field is decorated as deep observable. You can change the MobX flavour (`ref`, `shallow`, `struct`, `true`, or `false`) with the [`resultObservable`](#resultobservable-queryfeature) query feature.
298
+
::: info `observable.ref` is configurable
299
+
The badge reflects the **default**: the internal `_result` field is decorated as `observable.ref`. You can change the MobX flavour (`deep`, `shallow`, `struct`, `true`, or `false`) with the [`resultObservable`](#resultobservable-queryfeature) query feature.
300
300
:::
301
301
302
302
### `setData(updater, options)`
@@ -785,8 +785,9 @@ const query = new Query({
785
785
786
786
Chooses how MobX observes the internal TanStack Query result object (`_result`). The library applies [`annotation.observable()`](https://github.com/js2me/yummies) from `yummies/mobx`, so this maps directly to MobX flavours: `ref`, `deep`, `shallow`, `struct`, or `true` / `false`.
787
787
788
-
-**Default** — when omitted, behaviour matches **`'deep'`** (deep observability for plain objects and arrays in the result).
788
+
-**Default** — when omitted, behaviour matches **`'ref'`** (only the result object reference is tracked).
789
789
-**`'ref'`** — only the reference to the result object is tracked; use when the observer should react when the whole result is replaced, not when nested fields change in place.
790
+
-**`'deep'`** — deep observability for plain objects and arrays in the result.
790
791
-**`'shallow'`** / **`'struct'`** — shallow or structural comparison for nested properties.
791
792
-**`false`** — do not decorate `_result` with an observable annotation (rare; you lose automatic MobX tracking for the result blob).
0 commit comments