Skip to content

Commit 212fbfe

Browse files
authored
Update service-module.md -> add fields
add copiesById, enableEvents, addOnUpsert, diffOnPatch, skipRequestIfExists and preferUpdate
1 parent 6873036 commit 212fbfe

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/service-module.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,17 @@ Each service comes loaded with the following default state:
5252
{
5353
ids: [],
5454
keyedById: {}, // A hash map, keyed by id of each item
55+
copiesById: {}, // objects cloned with Model.clone()
5556
currentId: undefined, // The id of the item marked as current
5657
copy: undefined, // A deep copy of the current item
5758
idField: 'id',
5859
servicePath: 'v1/todos' // The full service path
5960
autoRemove: false, // Indicates that this service will not automatically remove results missing from subsequent requests.
61+
enableEvents: true, // Listens to socket.io events when available
62+
addOnUpsert: false, // Add new records pushed by 'updated/patched' socketio events into store, instead of discarding them
63+
diffOnPatch: false, // Only send changed data on patch
64+
skipRequestIfExists: false, // For get action, if the record already exists in store, skip the remote request
65+
preferUpdate: false, // When true, calling model.save() will do an update instead of a patch.
6066
replaceItems: false, // When set to true, updates and patches will replace the record in the store instead of merging changes
6167
paginate: false, // Indicates if pagination is enabled on the Feathers service.
6268

@@ -86,11 +92,17 @@ The following attributes are available in each service module's state:
8692

8793
- `ids {Array}` - an array of plain ids representing the ids that belong to each object in the `keyedById` map.
8894
- `keyedById {Object}` - a hash map keyed by the id of each item.
95+
- `copiesById {Object}` - objects cloned with Model.clone()
8996
- `currentId {Number|String}` - the id of the item marked as current.
9097
- `copy {Object}` - a deep copy of the current item at the moment it was marked as current. You can make changes to the copy without modifying the `current`. You can then use the `commitCopy` mutation to save the changes as the `current` or `rejectCopy` to revert `copy` to once again match `current`. You may prefer to use the new [clone API]() for [managing multiple copies with model instances](./common-patterns.md#Multiple-Copies).
9198
- `servicePath {String}` - the full service path, even if you alias the namespace to something else.
9299
- `modelName {String}` - the key in the $FeathersVuex plugin where the model will be found.
93-
- `autoRemove {Boolean` - indicates that this service will not automatically remove results missing from subsequent requests. Only use with feathers-rest. Default is false.
100+
- `autoRemove {Boolean}` - indicates that this service will not automatically remove results missing from subsequent requests. Only use with feathers-rest. Default is false.
101+
- `enableEvents {Boolean}` - Listens to socket.io events when available
102+
- `addOnUpsert {Boolean}` - Add new records pushed by 'updated/patched' socketio events into store, instead of discarding them
103+
- `diffOnPatch {Boolean}` - Only send changed data on patch
104+
- `skipRequestIfExists {Boolean}` - For get action, if the record already exists in store, skip the remote request
105+
- `preferUpdate {Boolean}`, // When true, calling model.save() will do an update instead of a patch.
94106
- `replaceItems {Boolean}` - When set to true, updates and patches will replace the record in the store instead of merging changes. Default is false
95107
- `idField {String}` - the name of the field that holds each item's id. *Default: `'id'`*
96108
- `paginate {Boolean}` - Indicates if the service has pagination turned on.

0 commit comments

Comments
 (0)