Skip to content

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

Open
@rjgotten

Description

@rjgotten

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions