Skip to content

Commit 66e35c3

Browse files
committed
fix check for temp record
Checking for the presence of the idField on a record is a better indicator of if the record is a temp. It beats checking for the lack of an `__id` field, because in Vue it’s sometimes a pain in the butt to get rid of properties thanks to using getters and setters for reactivity. This won’t be necessary once 3.0 ships with proxy-based reactivity.
1 parent 33f6da3 commit 66e35c3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

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

287287
if (copy) {
288-
const original = copy.__isTemp
289-
? state.tempsById[id]
290-
: state.keyedById[id]
288+
const original = copy[state.idField]
289+
? state.keyedById[id]
290+
: state.tempsById[id]
291291
mergeWithAccessors(copy, original)
292292
}
293293
},

0 commit comments

Comments
 (0)