Skip to content

Commit

Permalink
made requested fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IslandRhythms committed Jun 14, 2023
1 parent 97dec73 commit 9e08552
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/model.js
Expand Up @@ -719,12 +719,10 @@ Model.prototype.$__delta = function() {
const optimisticConcurrency = this.$__schema.options.optimisticConcurrency;
if (optimisticConcurrency) {
if (Array.isArray(optimisticConcurrency)) {
const optCon = new Set(optimisticConcurrency);
const modPaths = this.modifiedPaths();
for(let i = 0; i < modPaths.length; i++) {
if (modPaths.includes(optimisticConcurrency[i])) {
this.$__.version = dirty.length ? VERSION_ALL : VERSION_WHERE;
break;
}
if (modPaths.find(path => optCon.has(path))) {
this.$__.version = dirty.length ? VERSION_ALL : VERSION_WHERE;
}
} else {
this.$__.version = dirty.length ? VERSION_ALL : VERSION_WHERE;
Expand Down
2 changes: 1 addition & 1 deletion test/versioning.test.js
Expand Up @@ -526,7 +526,7 @@ describe('versioning', function() {
assert.equal(thing_1.__v, 1);
thing_2.set({ price: 1, name: 'Test' });
const err = await thing_2.save().then(() => null, err => err);
assert.ok(!err)
assert.ok(!err);
});

it('gh-1898', async function() {
Expand Down

0 comments on commit 9e08552

Please sign in to comment.