Skip to content

Commit 6fe51e9

Browse files
committed
Switch back to using Vue.set for changing store
1 parent 373e38a commit 6fe51e9

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/service-module/service-module.mutations.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ export default function makeServiceMutations() {
2323
const Model = _get(models, `[${serverAlias}][${modelName}]`)
2424
const BaseModel = _get(models, `[${state.serverAlias}].BaseModel`)
2525

26-
const newKeyedById = { ...state.keyedById }
27-
const newTempsById = { ...state.tempsById }
28-
2926
for (let item of items) {
3027
const id = getId(item, idField)
3128
const isTemp = id === null || id === undefined
@@ -45,16 +42,14 @@ export default function makeServiceMutations() {
4542
tempId = assignTempId(state, item)
4643
}
4744
item.__isTemp = true
48-
newTempsById[tempId] = item
45+
Vue.set(state.tempsById, tempId, item)
4946
} else {
5047
// Only add the id if it's not already in the `ids` list.
5148
if (!state.ids.includes(id)) {
5249
state.ids.push(id)
5350
}
54-
newKeyedById[id] = item
51+
Vue.set(state.keyedById, id, item)
5552
}
56-
state.keyedById = newKeyedById
57-
state.tempsById = newTempsById
5853
}
5954
}
6055

0 commit comments

Comments
 (0)