Skip to content

Commit 9c4107a

Browse files
committed
Changed order of mutation.set/length
1 parent 5a747b6 commit 9c4107a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dop",
3-
"version": "0.24.1",
3+
"version": "0.24.2",
44
"main": "./dist/dop.nodejs.js",
55
"browser": "./dist/dop.js",
66
"unpkg": "./dist/dop.min.js",

src/core/mutators/set.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ dop.core.set = function(object, property, value) {
4242
if (!isNewProperty)
4343
mutation.oldValue = dop.util.clone(oldValue)
4444

45+
dop.core.storeMutation(mutation);
46+
4547
// If is array and length is different we must store the length
4648
if (property !== 'length' && objectTarget.length !== length && objectIsArray)
4749
dop.core.storeMutation({
@@ -51,8 +53,6 @@ dop.core.set = function(object, property, value) {
5153
value: objectTarget.length,
5254
oldValue: length
5355
});
54-
55-
dop.core.storeMutation(mutation);
5656
}
5757
}
5858
}

test/mutation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,17 @@ test('Array.set', function(t) {
175175
var mutation = mutations[0]
176176
if (first) {
177177
t.equal(mutation.object, array.array, '.object')
178-
t.equal(mutation.prop, 'length', '.prop')
179-
t.deepEqual(mutation.value, 6, '.value')
180-
t.equal(mutation.oldValue, 3, '.oldValue')
178+
t.equal(mutation.prop, "5", '.prop')
179+
t.deepEqual(mutation.value, [true], '.value')
180+
t.equal(mutation.oldValue, undefined, '.oldValue')
181181
t.deepEqual(mutation.path, [2,'array'], '.path')
182182
first = false
183183
}
184184
else {
185185
t.equal(mutation.object, array.array, '.object')
186-
t.equal(mutation.prop, "5", '.prop')
187-
t.deepEqual(mutation.value, [true], '.value')
188-
t.equal(mutation.oldValue, undefined, '.oldValue')
186+
t.equal(mutation.prop, 'length', '.prop')
187+
t.deepEqual(mutation.value, 6, '.value')
188+
t.equal(mutation.oldValue, 3, '.oldValue')
189189
t.deepEqual(mutation.path, [2,'array'], '.path')
190190
}
191191
}

0 commit comments

Comments
 (0)