Skip to content

Commit 107507d

Browse files
committed
docs about version 3.0
1 parent d4e3dba commit 107507d

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

docs/.vuepress/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
editLinks: true,
1010
sidebar: [
1111
'/api-overview.md',
12+
'/3.0-major-release.md',
1213
'/vue-plugin.md',
1314
'/service-plugin.md',
1415
'/auth-plugin.md',
@@ -19,7 +20,7 @@ module.exports = {
1920
'/data-components.md',
2021
'/feathers-vuex-form-wrapper.md',
2122
'/nuxt.md',
22-
'/2.0-major-release.md'
23+
'/2.0-major-release.md',
2324
],
2425
serviceWorker: {
2526
updatePopup: true

docs/3.0-major-release.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: What's New in 3.0
3+
sidebarDepth: 3
4+
---
5+
6+
# What's new in Feathers-Vuex 3.0
7+
8+
## Vue Composition API Support
9+
10+
Version 3.0 of Feathers-Vuex is the Vue Composition API release! There were quite a few disappointed (and misinformed:) developers in 2019 when the Vue.js team announced what is now called the Vue Composition API. From my perspective:
11+
12+
- It is the most powerful feature added to Vue since its first release.
13+
- It improves the ability to create dynamic functionality in components.
14+
- It greatly enhances organization of code in components.
15+
- It encourages code re-use. Check out the [vue-use-web](https://logaretm.github.io/vue-use-web/) collection for some great examples.
16+
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+
19+
## A Single Breaking Change
20+
21+
Since Feathers-Vuex follows semantic versioning, a single, small breaking change is the reason for the major version bump. Feathers-Vuex 3.0 has only one breaking change:
22+
23+
The `makeFindMixin` (and the new `useFind` utility) now have server-side pagination support turned off, by default. Real-time arrays of results are now the default setting. This really improves the development experience, especially for new users.
24+
25+
To migrate your app to version 3.0, you need to update any `params` where you are using server-side pagination. It will work as it has been in version 2.0 once you explicitly set `paginate: true` in the params, like this:
26+
27+
```js
28+
import { makeFindMixin } from 'feathers-vuex'
29+
30+
export default {
31+
name: 'MyComponent',
32+
mixins: [ makeFindMixin({ service: 'users', watch: true })],
33+
computed: {
34+
usersParams() {
35+
return {
36+
query: {},
37+
paginate: true // explicitly enable pagination, now.
38+
}
39+
}
40+
}
41+
}
42+
```
43+
44+
That's the only breaking change in this release. This behavior exactly matches the new `useFind` utility.
45+
46+
## One Deprecation
47+
48+
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.
49+
50+
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-form-wrapper.md#the-clone-and-commit-pattern).
51+
52+
The `keepCopiesInStore` feature is set to be removed in Feathers-Vuex 4.0.

docs/feathers-vuex-form-wrapper.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,31 @@ The "Clone and Commit" pattern provides an alternative to using a lot of mutatio
2525
2. Create and modify a clone of the data.
2626
3. Use a single mutation to commit the changes back to the original record in the store.
2727

28-
Send most edits through a single mutation can really simplify the way you work with Vuex data. The Feathers-Vuex `BaseModel` class has `clone` and `commit` instance methods. Those methods are used inside the FeathersVuexFormWrapper component.
28+
Sending most edits through a single mutation can really simplify the way you work with Vuex data. The Feathers-Vuex `BaseModel` class has `clone` and `commit` instance methods. These methods provide a clean API for working with items in the Vuex store and supporting Vuex strict mode:
29+
30+
```js
31+
import { models } from 'feathers-vuex'
32+
33+
export default {
34+
name: 'MyComponent',
35+
created() {
36+
const { Todo } = models.api
37+
38+
const todo = new Todo({
39+
description: 'Plant the garden',
40+
isComplete: false
41+
})
42+
43+
const todoClone = todo.clone()
44+
todoClone.description = 'Plant half of the garden."
45+
todoClone.commit()
46+
}
47+
}
48+
```
49+
50+
In the example above, modifying the `todo` variable would directly modify part of the Vuex store outside of a mutation (also known as a reducer in Redux), which is a generally unsupportive practice. Calling `todo.clone()` returns a reactive clone of the instance and keeps it outside the Vuex store. This means you can make changes to it all you want without causing any trouble with Vuex. You can then call `todoClone.commit()` to update the original record in the store.
51+
52+
The `clone` and `commit` methods are used inside the FeathersVuexFormWrapper component.
2953
3054
## FeathersVuexFormWrapper
3155

0 commit comments

Comments
 (0)