Skip to content

ObservableArray.prototype.set throws an error #83

@phillipskevin

Description

@phillipskevin

With the changes to make class fields observable, setting expand properties using .set is now broken. Here is an example:

    class Foo extends ObservableArray{}
    const foo = new Foo();
    foo.set("count", 3)

This is the error thrown:

Uncaught TypeError: Cannot read property 'count' of undefined
    at Object.get Foo[].count [as get] (define.js:809)
    at Object.defineProperty (can-observable-array.js:67)
    at Function.defineProperty (<anonymous>)
    at Object_defineNamedPrototypeProperty (define.js:81)
    at Function.define.property (define.js:410)
    at Object.define.expando [as defineExpando] (define.js:1167)
    at Proxy.setKeyValue (mixin-mapprops.js:57)
    at Proxy.set (mixin-mapprops.js:108)
    at eval (eval at TodoList (observable-object-test.js:NaN), <anonymous>:4:9)
    at eval (eval at TodoList (observable-object-test.js:NaN), <anonymous>:5:2)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions