Skip to content

Commit bbe8be6

Browse files
committed
Fix logic for resetCopy and commitCopy
1 parent aeae7c2 commit bbe8be6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,10 @@ export default function makeServiceMutations() {
285285
: Model && _get(Model, `copiesById[${id}]`)
286286

287287
if (copy) {
288-
const original = copy[state.idField]
289-
? state.keyedById[id]
290-
: state.tempsById[id]
288+
const original =
289+
copy[state.idField] != null
290+
? state.keyedById[id]
291+
: state.tempsById[id]
291292
mergeWithAccessors(copy, original)
292293
}
293294
},
@@ -304,9 +305,10 @@ export default function makeServiceMutations() {
304305
: Model && _get(Model, `copiesById[${id}]`)
305306

306307
if (copy) {
307-
const original = copy.__isTemp
308-
? state.tempsById[id]
309-
: state.keyedById[id]
308+
const original =
309+
copy[state.idField] != null
310+
? state.keyedById[id]
311+
: state.tempsById[id]
310312
mergeWithAccessors(original, copy)
311313
}
312314
},

0 commit comments

Comments
 (0)