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/3.0-major-release.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,14 +65,14 @@ This behavior exactly matches the new `useFind` utility.
65
65
66
66
## Deprecations
67
67
68
-
### The `keepCopiesInStore` Option
68
+
### The `keepCopiesInStore` Option<Badgetext="deprecated"type="warning"/>
69
69
70
70
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.
71
71
72
72
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).
73
73
74
74
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.
Copy file name to clipboardExpand all lines: docs/common-patterns.md
+6-33Lines changed: 6 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,42 +174,15 @@ in the above example of component code, the `upcomingAppointments` and `pastAppo
174
174
175
175
## Organizing the services in your project
176
176
177
-
You can use the file system to organize each service into its own module. This is especially useful in organizing larger-sized projects. Here's an example `store.js`. It uses Webpack's require.context feature save repetitive imports:
177
+
You can use the file system to organize each service into its own module. This is especially useful in organizing larger-sized projects. Here's an example `store.js`. It uses Webpack's require.context feature save repetitive imports.
178
178
179
-
```js
180
-
importVuefrom'vue'
181
-
importVuexfrom'vuex'
182
-
import { FeathersVuex } from'../feathers-client'
183
-
importauthfrom'./store.auth'
184
-
185
-
Vue.use(Vuex)
186
-
Vue.use(FeathersVuex)
187
-
188
-
constrequireModule=require.context(
189
-
// The path where the service modules live
190
-
'./services',
191
-
// Whether to look in subfolders
192
-
false,
193
-
// Only include .js files (prevents duplicate imports`)
With the `store.js` file in place, we can start adding services to the `services` folder.
209
182
210
-
-[Learn how to setup a Vuex plugin for a Feathers service.](/api-overview.html#service-plugins)
211
-
-[Learn how to setup the feathers-client.js file](/api-overview.html)
212
-
-[Learn how to setup the auth plugin](/api-overview.html#auth-plugin)
183
+
-[Learn how to setup the feathers-client.js file](/getting-started.html#feathers-client-feathers-vuex)
184
+
-[Learn how to setup a Vuex plugin for a Feathers service](/getting-started.html#service-plugins)
185
+
-[Learn how to setup the auth plugin](/getting-started.html#auth-plugin)
213
186
214
187
## Actions return reactive store records
215
188
@@ -482,7 +455,7 @@ todoCopy.commit()
482
455
todoCopy2.commit()
483
456
```
484
457
485
-
You can use the `keepCopiesInStore` option to make this service keep all of its copies in `state.copiesById`. Remember that to comply with Vuex `strict` mode (if that's a concern for you), you'll have to write custom mutations. If it's not a concern (maybe you're the sole developer or whatever reason), you could technically turn off `strict` mode, enable `keepCopiesInStore`, and modify them however you desire, ignoring custom mutations.
458
+
You can use the `keepCopiesInStore`<Badgetext="deprecated"type="warning"/> option to make this service keep all of its copies in `state.copiesById`. Remember that to comply with Vuex `strict` mode (if that's a concern for you), you'll have to write custom mutations. If it's not a concern (maybe you're the sole developer or whatever reason), you could technically turn off `strict` mode, enable `keepCopiesInStore`, and modify them however you desire, ignoring custom mutations.
Copy file name to clipboardExpand all lines: docs/getting-started.md
+33-13Lines changed: 33 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -269,22 +269,42 @@ The following default options are available for configuration:
269
269
270
270
```js
271
271
constdefaultOptions= {
272
-
autoRemove:false, // Automatically remove records missing from responses (only use with feathers-rest)
273
-
addOnUpsert:false, // Add new records pushed by 'updated/patched' socketio events into store, instead of discarding them
274
-
enableEvents:true, // Listens to socket.io events when available. See the `handleEvents` API for more details
275
-
idField:'id', // The field in each record that will contain the id
276
-
tempIdField:'__id',
277
-
debug:false, // Set to true to enable logging messages.
278
-
keepCopiesInStore:false, // Set to true to store cloned copies in the store instead of on the Model.
279
-
nameStyle:'short', // Determines the source of the module name. 'short', 'path', or 'explicit'
280
-
paramsForServer: [], // Custom query operators that are ignored in the find getter, but will pass through to the server.
281
-
preferUpdate:false, // When true, calling model.save() will do an update instead of a patch.
282
-
replaceItems:false, // Instad of merging in changes in the store, replace the entire record.
272
+
// configured globally
283
273
serverAlias:'api',
284
-
skipRequestIfExists:false, // For get action, if the record already exists in store, skip the remote request
285
-
whitelist: [] // Custom query operators that will be allowed in the find getter.
274
+
keepCopiesInStore:false,
275
+
paramsForServer: [],
276
+
whitelist: []
277
+
278
+
// also configurable per service
279
+
idField:'id',
280
+
tempIdField:'__id',
281
+
debug:false,
282
+
addOnUpsert:false,
283
+
autoRemove:false,
284
+
enableEvents:true,
285
+
preferUpdate:false,
286
+
replaceItems:false,
287
+
skipRequestIfExists:false,
288
+
nameStyle:'short',
286
289
}
287
290
```
291
+
-`serverAlias` - **Default:**`api` - Models are keyed by `serverAlias`. Access the `$FeathersVuex` Plugin and its models in your components by `this.$FeathersVuex.api.${Model}`
292
+
-`keepCopiesInStore` - **Default:**`false` - Set to true to store cloned copies in the store instead of on the Model. <Badgetext="deprecated"type="warning" />
293
+
-`paramsForServer {Array}` - **Default:**`[]` - Custom query operators that are ignored in the find getter, but will pass through to the server.
294
+
-`whitelist {Array}` - **Default:**`[]` - Custom query operators that will be allowed in the find getter.
295
+
296
+
-`idField {String}` - **Default:**`'id'` - The field in each record that will contain the id
297
+
-`tempIdField {Boolean}` - **Default:**`'__id'` - The field in each temporary record that contains the id
298
+
-`debug {Boolean}` - **Default:**`false` - Enable some logging for debugging
299
+
-`addOnUpsert {Boolean}` - **Default:**`false` - If `true` add new records pushed by 'updated/patched' socketio events into store, instead of discarding them.
300
+
-`autoRemove {Boolean}` - **Default:**`false` - If `true` automatically remove records missing from responses (only use with feathers-rest)
301
+
-`enableEvents {Boolean}` - **Default:**`true` - If `false` socket event listeners will be turned off. See the services [handleEvents API](/service-plugin.html#configuration)
302
+
-`preferUpdate {Boolean}` - **Default:**`false` - If `true`, calling `model.save()` will do an `update` instead of a `patch`.
303
+
-`replaceItems {Boolean}` - **Default:**`false` - If `true`, updates & patches replace the record in the store. Default is false, which merges in changes.
304
+
-`skipRequestIfExists {Boolean}` - **Default:**`false` - For get action, if `true` the record already exists in store, skip the remote request.
305
+
-`nameStyle {'short'|'path'}` - **Default:**`'short'` - Use the full service path as the Vuex module name, instead of just the last section.
306
+
307
+
Also see the [Configs per Service](/service-plugin.html#configuration)
Copy file name to clipboardExpand all lines: docs/model-classes.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Feathers-Vuex 1.0 introduced some lightweight data modeling. Every service had
10
10
11
11
## Extending the BaseModel Class
12
12
13
-
While [setting up Feathers-Vuex](/api-overview.html#feathers-client-feathers-vuex), we exported the `BaseModel` class so that we could extend it. The below example shows how to import and extend the `BaseModel`. Each service must now have its own unique Model class.
13
+
While [setting up Feathers-Vuex](/getting-started.html#feathers-client-feathers-vuex), we exported the `BaseModel` class so that we could extend it. The below example shows how to import and extend the `BaseModel`. Each service must now have its own unique Model class.
There's another use case for using `.clone()`. Vuex has a `strict` mode that's really useful in development. It throws errors if any changes occur in the Vuex store `state` outside of mutations. Clone really comes in handy here, because you can make changes to the clone without having to write custom Vuex mutations. When you're finished making changes, call `.commit()` to update the store. This gives you `strict` mode compliance with little effort!
362
362
363
-
> Nonte: You could previously use the `keepCopiesInStore` option to keep copies in `state.copiesById`. In 2.0, this feature is deprecated and will be removed from the next release.
363
+
> Note: You could previously use the `keepCopiesInStore`<Badgetext="deprecated"type="warning"/> option to keep copies in `state.copiesById`. In 2.0, this feature is deprecated and will be removed from the next release.
Copy file name to clipboardExpand all lines: docs/nuxt.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ The `models` and `$FeathersVuex` variables are the same object.
16
16
17
17
## Preventing Memory Leaks
18
18
19
-
The default settings of Feathers-Vuex include having realtime events enabled by default. This will result in increased memory usage over time on the SSR server. It can be turned off when you configure `feathers-vuex`. The example below has been modified from the example of [Setting up the Feathers Client & Feathers-Vuex](./api-overview.md#feathers-client-feathers-vuex). Look specifically at the `enableEvents` option.
19
+
The default settings of Feathers-Vuex include having realtime events enabled by default. This will result in increased memory usage over time on the SSR server. It can be turned off when you configure `feathers-vuex`. The example below has been modified from the example of [Setting up the Feathers Client & Feathers-Vuex](./getting-started.html#feathers-client-feathers-vuex). Look specifically at the `enableEvents` option.
0 commit comments