Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using get/set members for DefineMap wildcard properties leads to a reproducible uncaught TypeError #472

Open
1 of 5 tasks
rjgotten opened this issue Sep 23, 2019 · 0 comments

Comments

@rjgotten
Copy link

How often can you reproduce it?

  • Always
  • Sometimes
  • Rarely
  • Unable
  • I didn’t try

Description:
Creating a DefineMap subclass with wildcard properties that use get/set definitions and then attempting to read any wildcard properties after setting them results in a thrown error that seems to indicate this._computed is not set up properly for wildcard instance properties.

Steps to reproduce:

JSBin

import { DefineMap } from "//unpkg.com/[email protected]/everything.mjs";

const WildcardMap = DefineMap.extend( "WildcardMap", { seal : false }, {
  "*" : {
    get( lastSet ) { return lastSet; },
    set( value, setValue ) { setValue( value ); }
  }
});

let map = new WildcardMap();
map.set( "foo", "bar" );

console.log(map.foo);

Expected results:
Console logs "bar"

Actual results:
Console reports thrown error:

Uncaught TypeError: Cannot read property 'compute' of undefined
    at WildcardMap.get WildcardMap{}.foo (everything.mjs:9608)

Environment:

Software Version
can-define version 2.8.0
Browser Any
Operating system Any
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

No branches or pull requests

1 participant