Skip to content

Commit 46d00d7

Browse files
committed
Use notifyPropertyChange on content instead of proxy
Changes done in Ember 3.13 around tracked properties broke this add-on. When a value of property changes on a buffer it somehow doesn't propagate the change. In other words, if you have an <input> where you modify the value and you render the value in other places then it doesn't refresh. Notifying a property change on content instead of proxy (this) seems to solve the issue.
1 parent 4ad71e4 commit 46d00d7

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

addon/mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default Mixin.create({
7474
set(this, 'hasBufferedChanges', true);
7575
}
7676

77-
notifyPropertyChange(this, key);
77+
notifyPropertyChange(content, key);
7878

7979
return value;
8080
},

tests/unit/mixin-test.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import {
99
module('ember-buffered-proxy/mixin', function() {
1010
test('that it works', (assert) => {
1111
const BufferedProxy = ObjectProxy.extend(Mixin);
12-
const content = { baz: 1 };
12+
const content = {
13+
baz: 1,
14+
notifyPropertyChange() {}
15+
};
1316

1417
const proxy = BufferedProxy.create({ content });
1518

@@ -58,8 +61,11 @@ module('ember-buffered-proxy/mixin', function() {
5861

5962
test('that apply/discard only these keys works', (assert) => {
6063
const BufferedProxy = ObjectProxy.extend(Mixin);
61-
const content = { baz: 1, world: 'hello' };
62-
64+
const content = {
65+
baz: 1,
66+
world: 'hello',
67+
notifyPropertyChange() {}
68+
};
6369
const proxy = BufferedProxy.create({ content });
6470

6571
assert.equal(get(proxy, 'baz'), 1);
@@ -146,7 +152,10 @@ module('ember-buffered-proxy/mixin', function() {
146152
test('aliased methods work', (assert) => {
147153
const BufferedProxy = ObjectProxy.extend(Mixin);
148154
const proxy = BufferedProxy.create({
149-
content: { property: 1 }
155+
content: {
156+
property: 1,
157+
notifyPropertyChange() {}
158+
}
150159
});
151160

152161
set(proxy, 'property', 2);
@@ -166,8 +175,11 @@ module('ember-buffered-proxy/mixin', function() {
166175
const BufferedProxy = ObjectProxy.extend(Mixin);
167176
const fakeContainer = EmberObject.create({});
168177

169-
var proxy = BufferedProxy.create({
170-
content: { property: 1 },
178+
const proxy = BufferedProxy.create({
179+
content: {
180+
property: 1,
181+
notifyPropertyChange() {}
182+
},
171183
container: fakeContainer,
172184
foo: 'foo',
173185
});
@@ -178,7 +190,9 @@ module('ember-buffered-proxy/mixin', function() {
178190

179191
test('that .hasChanged() works', (assert) => {
180192
const BufferedProxy = ObjectProxy.extend(Mixin);
181-
const content = {};
193+
const content = {
194+
notifyPropertyChange() {}
195+
};
182196

183197
const proxy = BufferedProxy.create({ content });
184198

0 commit comments

Comments
 (0)