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
Copy file name to clipboardExpand all lines: docs/framework/vue/reactivity.md
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -157,10 +157,17 @@ export function useUserProjects(userId: MaybeRef<string>) {
157
157
158
158
More details on this option can be found on the [useQuery reference](./reference/useQuery.md) page.
159
159
160
+
## Immutability
161
+
162
+
Results from `useQuery` are always immutable. This is necessary for performance and caching purposes. If you need to mutate a value returned from `useQuery`, you must create a copy of the data.
163
+
164
+
One implication of this design is that passing values from `useQuery` to a two-way binding such as `v-model` will not work. You must create a mutable copy of the data before attempting to update it in place.
165
+
160
166
# Key Takeaways
161
167
162
168
-`enabled` and `queryKey` are the two query options that can accept reactive values.
163
169
- Pass query option that accept all three types of values in Vue: refs, plain values, and reactive getters.
164
170
- If you expect a query to react to changes based on the values it consumes, ensure that the values are reactive. (i.e. pass in refs directly to the query, or use reactive getters)
165
171
- If you don't need a query to be reactive pass in a plain value.
166
172
- For trivial derived state such as property access consider using a reactive getter in place of a `computed`.
0 commit comments