addon/components/power-select-typeahead/trigger.js
/**
   * Lifecycle Hook
   * power-select updates the state of the publicAPI (select) for every typeahead
   * so we capture this as `state` via oldSelect && newSelect
   *
   * @private
   * @method didReceiveAttrs
   */
Lifecycle Hook
power-select updates the state of the publicAPI (select) for every typeahead
so we capture this as `state` via oldSelect && newSelect


Lifecycle Hook power - select updates the state of the publicAPI ( select ) for every typeahead so we capture this as ` state ` via oldSelect && newSelect
didReceiveAttrs() {
    this._super(...arguments);
    let oldSelect = this.get('oldSelect');
    let newSelect = this.set('oldSelect', this.get('select'));
    if (!oldSelect) {
      return;
    }
    if (oldSelect.isOpen && !newSelect.isOpen && newSelect.searchText) {
      let input = document.querySelector(`#ember-power-select-typeahead-input-${newSelect.uniqueId}`);
      let newText = this.getSelectedAsText();
      if (input.value !== newText) {
        input.value = newText;
      }
      this.set('text', newText);
    }
    if (newSelect.lastSearchedText !== oldSelect.lastSearchedText) {
      if (isBlank(newSelect.lastSearchedText)) {
        run.schedule('actions', null, newSelect.actions.close, null, true);
      } else {
        run.schedule('actions', null, newSelect.actions.open);
      }
    }
    if (oldSelect.selected !== newSelect.selected) {
      this.set('text', this.getSelectedAsText());
    }
  }
didReceiveAttrs ( ) { this . _super ( ... arguments ) ; let oldSelect = this . get ( 'oldSelect' ) ; let newSelect = this . set ( 'oldSelect' , this . get ( 'select' ) ) ; if ( ! oldSelect ) { return ; } if ( oldSelect . isOpen && ! newSelect . isOpen && newSelect . searchText ) { let input = document . querySelector ( ` ${ newSelect . uniqueId } ` ) ; let newText = this . getSelectedAsText ( ) ; if ( input . value !== newText ) { input . value = newText ; } this . set ( 'text' , newText ) ; } if ( newSelect . lastSearchedText !== oldSelect . lastSearchedText ) { if ( isBlank ( newSelect . lastSearchedText ) ) { run . schedule ( 'actions' , null , newSelect . actions . close , null , true ) ; } else { run . schedule ( 'actions' , null , newSelect . actions . open ) ; } } if ( oldSelect . selected !== newSelect . selected ) { this . set ( 'text' , this . getSelectedAsText ( ) ) ; } }
Lifecycle Hook
 power-select updates the state of the publicAPI (select) for every typeahead
 so we capture this as `state` via oldSelect && newSelect
Lifecycle Hook power - select updates the state of the publicAPI ( select ) for every typeahead so we capture this as ` state ` via oldSelect && newSelect
/*
     * We need to update the input field with value of the selected option whenever we're closing
     * the select box.
     */