Skip to content

Commit c0435f6

Browse files
committed
fix: clearCopy for keepCopiesInStore: false
1 parent 59bd17a commit c0435f6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,17 @@ export default function makeServiceMutations() {
321321

322322
// Removes the copy from copiesById
323323
clearCopy(state, id) {
324-
const newCopiesById = Object.assign({}, state.copiesById)
325-
delete newCopiesById[id]
326-
state.copiesById = newCopiesById
324+
const { keepCopiesInStore } = state
325+
if (keepCopiesInStore) {
326+
Vue.delete(state.copiesById, id)
327+
} else {
328+
const { serverAlias, servicePath } = state
329+
const Model = _get(
330+
models,
331+
`[${serverAlias}].byServicePath[${servicePath}]`
332+
)
333+
Vue.delete(Model.copiesById, id)
334+
}
327335
},
328336

329337
/**

0 commit comments

Comments
 (0)