Skip to content

Conversation

@cherifGsoul
Copy link
Member

@cherifGsoul cherifGsoul commented May 20, 2020

Fix the item mutation with array mutation methods like push:

const myList = new ObservableArray([0,1]);
myList.push("I am going to hide some changes.");
		
canReflect.onPatches(myList, function (patches) {
    console.log(patches[0].insert[0]);   // -> 'Patched after push'
});
	
myList[1] = "Patched after push";

Closes #82

@cherifGsoul cherifGsoul requested a review from phillipskevin May 20, 2020 21:56

QUnit.test("value, oldValue, action, key on event object", function(assert) {
assert.expect(22);
assert.expect(26);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cherifGsoul can you explain why there are more assertions now?

mixins.finalizeClass(new.target);
mixins.initialize(this, props || {});

this[metaSymbol].preventSideEffects = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do you know why this property is not initialized? It looks like it should be here:

preventSideEffects: 0
.

@cherifGsoul cherifGsoul requested a review from phillipskevin May 22, 2020 19:33
@cherifGsoul cherifGsoul merged commit bf070db into master May 22, 2020
@cherifGsoul cherifGsoul deleted the fix-mutating-with-push branch May 22, 2020 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Patches are not dispatched after mutation methods usage

3 participants