Merge pull request #1761 from dmitrykurmanov/patch-1

Update error message in the Store
pull/1775/head
Rich Harris 6 years ago committed by GitHub
commit 7251a12539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -162,7 +162,7 @@ assign(Store.prototype, {
let dirty = false; let dirty = false;
for (const key in newState) { for (const key in newState) {
if (this._computed[key]) throw new Error(`'${key}' is a read-only property`); if (this._computed[key]) throw new Error(`'${key}' is a read-only computed property`);
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
} }
if (!dirty) return; if (!dirty) return;

@ -118,7 +118,7 @@ describe('store', () => {
assert.throws(() => { assert.throws(() => {
store.set({ bar: 'whatever' }); store.set({ bar: 'whatever' });
}, /'bar' is a read-only property/); }, /'bar' is a read-only computed property/);
}); });
it('allows multiple dependents to depend on the same computed property', () => { it('allows multiple dependents to depend on the same computed property', () => {

Loading…
Cancel
Save