Skip to content

depending on "model.constructor.modelName" sets model.constructor to undefined #14014

@spruce

Description

@spruce

In my app I use an computed property to state how many steps are left to do for creating the models. This depends on how many steps are already done and which kind of model it is currently creating. (We create different kind of coworkers)

In Ember 2.5 it did work. After upgrading or slightly after (not quite sure) it stopped working.

this is my cp

numberOfSubSteps: Ember.computed('model.constructor.modelName', function() {
    let valueBasedOnModel = 4;
    switch(this.get('model.constructor.modelName')) {
      case 'kurzfristig':
        valueBasedOnModel = 5;
        break;
      case 'geringfugig':
        valueBasedOnModel = 6;
        break;
...
    }
    return valueBasedOnModel;
  }),

I found the exact line where it changes the constructor. (It defines a new property which somehow is then returning undefined.)
https://github.com/emberjs/ember.js/blob/master/packages/ember-metal/lib/watch_key.js#L81

This is the callstack when it happens
screenshot 2016-08-03 um 17 05 44

might be somewhat related to #9387

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions