ciena-frost / ember-frost-core

http://ciena-frost.github.io/ember-frost-core/
MIT License
18 stars 42 forks source link

Fixed dropdown not updating when select items change #530

Closed TheOtherDude closed 6 years ago

TheOtherDude commented 6 years ago

This project uses semver, please check the scope of this pr:

CHANGELOG

TheOtherDude commented 6 years ago

I discussed alternatives with @notmessenger and @juwara0 . One theory was that using a computed property that returned copies of these named properties might work. I tried it, but unfortunately the tests still failed.

  @readOnly
  @computed('items')
  computedItems (items) {
    return items.slice()
  },

  {{to-elsewhere
    named=renderTarget
    send=(component 'frost-select-dropdown'
      $element=$element
      filter=filter
      hook=hook
      items=computedItems
      multiselect=multiselect
      onClose=(action 'closeDropDown')
      onFilterInput=(action 'filterInput')
      onSelect=(action 'selectItem')
      selectedItems=selectedItems
      wrapLabels=wrapLabels
    )
  }}

Doesn't work ^

notmessenger commented 6 years ago

@TheOtherDude It's because https://github.com/ciena-frost/ember-frost-core/blob/master/addon/components/frost-select-dropdown.js#L184 is not watching items.[]. This might actually be the entire problem at play here.

TheOtherDude commented 6 years ago

I've confirmed that watching items.[] makes no difference.

Logging does not even trigger in the computed property when items is updated. If I add {{log computedItems}} to the template, then I can see it recomputing, but the drop down still does not re-render.

notmessenger commented 6 years ago

👍

Approved with PullApprove