Skip to content

Commit 43e0d0b

Browse files
Merge branch 'master' into 1.0
2 parents 05e348e + e6a91d1 commit 43e0d0b

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
npm install feathers-vuex --save
1313
```
1414

15+
## Important
16+
The current version of `feathers-vuex` is not compatible with the latest version of `feathers-reactive` (0.5.x). To keep on using `feathers-vuex` install version 0.4.x.
17+
1518
## Use
1619
`feathers-vuex` is a set of two utilities for integrating the Feathers Client into your Vuex store. It allows you to eliminate boilerplate and easily customize the store. To get it working, we first need a Feathers Client. Note: as of version 1.0.0 `feathers-reactive` is no longer required to get socket updates.
1720

src/service-module/mutations.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,16 @@ export default function makeServiceMutations (servicePath) {
127127
}
128128
},
129129

130-
setCurrent (state, item) {
131-
const { idField } = state
132-
let id = isObject(item) ? item[idField] : item
130+
setCurrent (state, itemOrId) {
131+
let id
132+
let item
133+
if (isObject(itemOrId)) {
134+
id = itemOrId[idField]
135+
item = itemOrId
136+
} else {
137+
id = itemOrId
138+
item = state.keyedById[id]
139+
}
133140
state.currentId = id
134141
state.copy = _cloneDeep(item)
135142
},

test/service-module/mutations.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ describe('Service Module - Mutations', function () {
249249

250250
assert(state.currentId === 2)
251251
assert.deepEqual(state.copy, item2)
252+
253+
setCurrent(state, item1._id)
254+
255+
assert(state.currentId === 1)
256+
assert.deepEqual(state.copy, item1)
252257
})
253258

254259
it('clearCurrent', function () {

0 commit comments

Comments
 (0)