Skip to content

Commit

Permalink
fix computed property overrides deprecation. fixes #1146
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed May 9, 2020
1 parent 48f7ad5 commit 52dd556
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
27 changes: 18 additions & 9 deletions addon/components/paper-progress-linear.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,27 @@ export default Component.extend(ColorMixin, {

constants: service(),

mode: computed('value', function() {
let value = this.get('value');
let bufferValue = this.get('bufferValue');
mode: computed('value', {
get() {
if (this._mode !== undefined) {
return this._mode;
}

if (isPresent(value)) {
if (isPresent(bufferValue)) {
return MODE_BUFFER;
let value = this.get('value');
let bufferValue = this.get('bufferValue');

if (isPresent(value)) {
if (isPresent(bufferValue)) {
return MODE_BUFFER;
} else {
return MODE_DETERMINATE;
}
} else {
return MODE_DETERMINATE;
return MODE_INDETERMINATE;
}
} else {
return MODE_INDETERMINATE;
},
set(key, value) {
return this._mode = value;
}
}),

Expand Down
14 changes: 12 additions & 2 deletions addon/mixins/child-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@ export default Mixin.create({
parentClass: ParentMixin,

// this will typically be overriden when yielding a contextual component
parentComponent: computed(function() {
return this.nearestOfType(this.get('parentClass'));
parentComponent: computed({
get() {
if (this._parentComponent !== undefined) {
return this._parentComponent;
}

return this.nearestOfType(this.get('parentClass'));
},

set(key, value) {
return this._parentComponent = value;
}
}),

init() {
Expand Down

0 comments on commit 52dd556

Please sign in to comment.