Skip to content

Commit

Permalink
Change flashes to not use LimitedArray
Browse files Browse the repository at this point in the history
The way LimitedArray was being used is now forbidden in Ember 3:
emberjs/ember.js#16157
  • Loading branch information
backspace committed May 9, 2018
1 parent 037323e commit db7c0eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions app/services/flashes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { run } from '@ember/runloop';
import Service from '@ember/service';
import LimitedArray from 'travis/utils/limited-array';
import { computed } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';
import { service } from 'ember-decorators/service';
Expand Down Expand Up @@ -39,17 +38,14 @@ export default Service.extend({
},

setup() {
this.set('flashes', LimitedArray.create({
limit: 1,
content: []
}));
this.set('flashes', []);
},

@computed('flashes.[]')
messages(flashes) {
let model = [];
if (flashes.length) {
model.pushObjects(flashes.toArray().reverse());
model.pushObjects(flashes.toArray());
}
return model.uniq();
},
Expand Down
6 changes: 3 additions & 3 deletions app/templates/components/flash-display.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#each messages as |flash|}}
{{flash-item data-test-components-flash-item flash=flash close=(action 'closeMessage')}}
{{/each}}
{{#if messages.firstObject}}
{{flash-item data-test-components-flash-item flash=messages.firstObject close=(action 'closeMessage')}}
{{/if}}

0 comments on commit db7c0eb

Please sign in to comment.