Skip to content

Commit 59c7d25

Browse files
committed
add removeTemps to docs and fix tempIdField
1 parent 0de90a7 commit 59c7d25

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

docs/service-plugin.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ Removes a single item. `item` can be
232232

233233
- `item {Number|String|Object}` - The item or id of the item to be deleted.
234234

235+
### `removeTemps(state, tempIds)`
236+
237+
// Removes temp records. Also cleans up tempsByNewId
238+
239+
- `items {Array}` - An array of ids or of objects with tempIds that will be removed from the data store
240+
235241
### `removeItems(state, items)`
236242

237243
Removes the passed in items or ids from the store.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ export default function makeServiceMutations() {
179179
removeTemps(state, tempIds) {
180180
const ids = tempIds.reduce((ids, id) => {
181181
const temp = state.tempsById[id]
182-
if (temp && temp[state.idField]) {
182+
if (temp && temp[state.tempIdField]) {
183183
delete temp.__isTemp
184184
Vue.delete(temp, '__isTemp')
185-
ids.push(temp[state.idField])
185+
ids.push(temp[state.tempIdField])
186186
}
187187
return ids
188188
}, [])

0 commit comments

Comments
 (0)