Skip to content

Commit 10088ee

Browse files
committed
clearCopy on model-remove for temp
1 parent dda115c commit 10088ee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/service-module/make-base-model.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ export default function makeBaseModel(options: FeathersVuexOptions) {
7979
public static serverAlias: string = options.serverAlias
8080

8181
public static readonly models = globalModels as GlobalModels // Can access other Models here
82-
public static copiesById: {
82+
83+
public static readonly copiesById: {
8384
[key: string]: Model | undefined
8485
[key: number]: Model | undefined
8586
} = {}
@@ -365,7 +366,9 @@ export default function makeBaseModel(options: FeathersVuexOptions) {
365366
* Calls service patch with the current instance data
366367
* @param params
367368
*/
368-
public patch<D extends {} = AnyData>(params?: PatchParams<D>): Promise<this> {
369+
public patch<D extends {} = AnyData>(
370+
params?: PatchParams<D>
371+
): Promise<this> {
369372
const { idField, _dispatch } = this.constructor as typeof BaseModel
370373
const id = getId(this, idField)
371374

@@ -410,7 +413,9 @@ export default function makeBaseModel(options: FeathersVuexOptions) {
410413
}
411414
return _dispatch.call(this.constructor, 'remove', [id, params])
412415
} else {
416+
// is temp
413417
_commit.call(this.constructor, 'removeTemps', [this[tempIdField]])
418+
_commit.call(this.constructor, 'clearCopy', [this[tempIdField]])
414419
return Promise.resolve(this)
415420
}
416421
}

0 commit comments

Comments
 (0)