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/2.0-major-release.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,8 @@ I have not been able to find a diffing algorithm that works equally well acroos
163
163
164
164
## Model Classes: BYOD (Bring Your Own Diffing)
165
165
166
+
> Note: As of `[email protected]`, you can also pass `params.data` to the patch object to implement partial patching on objects. You might choose to use `params.data` instead of `diffOnPatch`.
167
+
166
168
First, why do any diffing? On the API server, an `update` request replaces an entire object, but a `patch` request only overwrites the attributes that are provided in the data. For services with simple schemas, it doesn't really matter. But if your schema grows really large, it can be supportive to only send the updates instead of the entire object.
167
169
168
170
A new `diffOnPatch` method is available to override in your extended models. `diffOnPatch` gets called just before sending the data to the API server. It gets called with the data and must return the diffed data. By default, it is set to `diffOnPatch: data => data`.
Copy file name to clipboardExpand all lines: docs/3.0-major-release.md
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,21 @@ Version 3.0 of Feathers-Vuex is the Vue Composition API release! There were qui
16
16
17
17
And now it has become the best way to perform queries with Feathers-Vuex. To find out how to take advantage of the new functionality in your apps, read the [Feather-Vuex Composition API docs](./composition-api.md).
18
18
19
+
## Partial data on patch <Badgetext="3.9.0+" />
20
+
As of version 3.9.0, you can provide an object as `params.data`, and Feathers-Vuex will use `params.data` as the patch data. This change was made to the service-module, itself, so it will work for `patch` across all of feathers-vuex. Here's an example of patching with partial data:
To assist with Server Side Pagination support, Feathers-Vuex now includes the `<FeathersVuexPagination>` component. It's a renderless component that removes the boilerplate behind handling pagination in the UI. Read about it in the [Composition API Docs](/composition-api.html#feathersvuexpagination).
@@ -69,14 +84,18 @@ This behavior exactly matches the new `useFind` utility.
69
84
70
85
## Deprecations
71
86
72
-
### The `keepCopiesInStore` Option<Badgetext="deprecated"type="warning"/>
87
+
### The `keepCopiesInStore` Option<Badgetext="deprecated"type="warning"/>
73
88
74
89
The `keepCopiesInStore` option is now deprecated. This was a part of the "clone and commit" API which basically disabled the reason for creating the "clone and commit" API in the first place.
75
90
76
91
If you're not familiar with the Feathers-Vuex "clone and commit" API, you can learn more about the [built-in data modeling](./model-classes.md) API and the section about [Working with Forms](./feathers-vuex-forms.md#the-clone-and-commit-pattern).
77
92
78
93
The `keepCopiesInStore` feature is set to be removed in Feathers-Vuex 4.0.
As described, earlier on this page, since the Auth Plugin's `user` state is no longer reactive and has been replaced by a `user` getter that IS reactive, the `user` state will be removed in the Feathers-Vuex 4.0.
98
+
99
+
### Renderless Data Components: `query`, `fetchQuery` and `temps` <Badge text="deprecated type="warning">
100
+
101
+
To keep consistency with mixins and the composition API it's preferred to use `params` and `fetchParams` instead of the old `query` and `fetchQuery` for renderless data components. Also the `:temps="true"` is deprecated in favour of `:params="{ query: {}, temps: true }"`. This way additional params can be passed to the server if you need some more magic like `$populateParams`.
Copy file name to clipboardExpand all lines: docs/common-patterns.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -278,6 +278,8 @@ class Post extends BaseModel {
278
278
279
279
## Relationships for Populated Data
280
280
281
+
If you're looking for a great solution for populating data to work with Feathers-Vuex, check out [feathers-graph-populate](https://feathers-graph-populate.netlify.app/).
282
+
281
283
A common task with almost any API is properly handling relationships between endpoints. Imagine an API where you have `/todos` and `/users` services. Each todo record can belong to a single user, so a todo has a `userId`.
Copy file name to clipboardExpand all lines: docs/composition-api.md
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,7 +105,7 @@ interface UseFindOptions {
105
105
fetchParams?:Params|Ref<Params>
106
106
queryWhen?:Ref<Function>
107
107
qid?:string
108
-
lazy?:boolean
108
+
immediate?:boolean
109
109
}
110
110
```
111
111
@@ -123,7 +123,7 @@ And here's a look at each individual property:
123
123
- Explicitly returning `null` will prevent an API request from being made.
124
124
-`queryWhen` must be a `computed` property which returns a `boolean`. It provides a logical separation for preventing API requests *outside* of the `params`.
125
125
-`qid` allows you to specify a query identifier (used in the pagination data in the store). This can also be set dynamically by returning a `qid` in the params.
126
-
-`lazy`, which is `false` by default, determines if the internal `watch` should fire immediately. Set `lazy: true` and the query will not fire immediately. It will only fire on subsequent changes to the params.
126
+
-`immediate`, which is `true` by default, determines if the internal `watch` should fire immediately. Set `immediate: false` and the query will not fire immediately. It will only fire on subsequent changes to the params.
127
127
128
128
### Returned Attributes
129
129
@@ -150,8 +150,8 @@ Let's look at the functionality that each one provides:
150
150
151
151
-`items` is the list of results. By default, this list will be reactive, so if new items are created which match the query, they will show up in this list automagically.
152
152
-`servicePath` is the FeathersJS service path that is used by the current model. This is mostly only useful for debugging.
153
-
-`isFindPending` is a boolean that indicates if there is an active query. It is set to `true` just before each outgoing request. It is set to `false` after the response returns. Bind to it in the UI to show an activity indicator to the user.
154
-
-`haveBeenRequestedOnce` is a boolean that is set to `true` immediately before the first query is sent out. It remains true throughout the life of the component. This comes in handy for first-load scenarios in the UI.
153
+
-`isPending` is a boolean that indicates if there is an active query. It is set to `true` just before each outgoing request. It is set to `false` after the response returns. Bind to it in the UI to show an activity indicator to the user.
154
+
-`haveBeenRequested` is a boolean that is set to `true` immediately before the first query is sent out. It remains true throughout the life of the component. This comes in handy for first-load scenarios in the UI.
155
155
-`haveLoaded` is a boolean that is set to true after the first API response. It remains `true` for the life of the component. This also comes in handy for first-load scenarios in the UI.
156
156
-`isLocal` is a boolean that is set to true if this data is local only.
157
157
-`qid` is currently the primary `qid` provided in params. It might become more useful in the future.
@@ -208,7 +208,7 @@ If you have already used the `makeFindMixin`, the `useFind` composition function
208
208
209
209
1.`useFind` is more TypeScript friendly. Since the mixins depended on adding dynamic attribute names that wouldn't overlap, TypeScript tooling and autocomplete weren't very effective. The attributes returned from `useFind` are always consistent.
210
210
1. Instead of providing a service name, you provide a service Model from the `$FeathersVuex` Vue plugin.
211
-
1. The default behavior of `useFind` is to immediately query the API server. The `makeFindMixin`, by default, would wait until the watcher noticed the change. This is to match the default behavior of `watch` in the Vue Composition API. You can pass `{ lazy: true }` in the `useFind` options, which will be passed directly to the internal `watch` on the params.
211
+
1. The default behavior of `useFind` is to immediately query the API server. The `makeFindMixin`, by default, would wait until the watcher noticed the change. This is to match the default behavior of `watch` in the Vue Composition API. You can pass `{ immediate: false }` in the `useFind` options, which will be passed directly to the internal `watch` on the params.
212
212
213
213
Note that with the Vue Options API (aka the only way to write components in Vue 2.0) the models are found in `this.$FeathersVuex`. With the Vue Composition API, this object is now at `context.root.$FeathersVuex`.
214
214
@@ -268,7 +268,7 @@ interface UseGetOptions {
268
268
params?: Params | Ref<Params>
269
269
queryWhen?: Ref<Function>
270
270
local?: boolean
271
-
lazy?: boolean
271
+
immediate?: boolean
272
272
}
273
273
```
274
274
@@ -281,7 +281,7 @@ And here's a look at each individual property:
281
281
- `params` is a FeathersJS Params object OR a Composition API `ref` (or `computed`, since they return a `ref` instance) which returns a Params object.
282
282
- Unlike the `useFind` utility, `useGet` does not currently have built-in debouncing.
283
283
- `queryWhen` must be a `computed` property which returns a `boolean`. It provides a logical separation for preventing API requests apart from `null` in the `id`.
284
-
- `lazy`, which is `false` by default, determines if the internal `watch` should fire immediately. Set `lazy:true` and the query will not fire immediately. It will only fire on subsequent changes to the `id` or `params`.
284
+
- `immediate`, which is `true` by default, determines if the internal `watch` should fire immediately. Set `immediate:false` and the query will not fire immediately. It will only fire on subsequent changes to the `id` or `params`.
285
285
286
286
### Returned Attributes
287
287
@@ -779,6 +779,21 @@ export default new Router({
779
779
780
780
Now, the `Post.vue` file only requires to have a `prop` named `id`. Vue Router will pass the params from the route as props to the component. See the [first useGet example](#useget) for a component that would work with the above route. The vue-router documentation has more information about [Passing Props to Route Components](https://router.vuejs.org/guide/essentials/passing-props.html#passing-props-to-route-components)
781
781
782
+
### Composing with Model types
783
+
784
+
Both `useGet` and `useFind` have an optional type parameter for the Model type which is used as the type for the returned item(s).
785
+
786
+
```ts
787
+
// Destructure Model class from global models object
0 commit comments