<commit_before>import Ember from 'ember';
import layout from '../templates/components/em-select';

export default Ember.Component.extend({
  layout,
  classNames: ['input-field'],
  prompt: 'Select...',
  didInsertElement() {
    this._super(...arguments);

    let value = this.get('value');
    Ember.$.each(this.$('option'), function(name, option) {
      if (option.value === value) {
        Ember.$(option).attr('selected', 'selected');
      }
    });
    this.$('select').material_select();
  },
  willDestroyElement() {
    this._super(...arguments);
    this.$('select').material_select('destroy');
  },
  actions: {
    'on-change'(e) {
      this.set('value', e);
      this.set('selection', this.get('content').findBy(this.get('optionValuePath'), e));
    }
  }<commit_msg>this.set('value', e) would incorrectly update the previously selected item to the value of the newly selected item.<commit_after>import Ember from 'ember';
import layout from '../templates/components/em-select';

export default Ember.Component.extend({
  layout,
  classNames: ['input-field'],
  prompt: 'Select...',
  didInsertElement() {
    this._super(...arguments);

    let value = this.get('value');
    Ember.$.each(this.$('option'), function(name, option) {
      if (option.value === value) {
        Ember.$(option).attr('selected', 'selected');
      }
    });
    this.$('select').material_select();
  },
  willDestroyElement() {
    this._super(...arguments);
    this.$('select').material_select('destroy');
  },
  actions: {
    'on-change'(e) {
      this.set('selection', this.get('content').findBy(this.get('optionValuePath'), e));
    }
  }
{'fraction_non_alphanumeric': 0.19927095990279464, 'fraction_numerical': 0.0, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '749473', 'n_tokens_mistral': 504, 'n_tokens_neox': 499, 'n_words': 94}