adopted-ember-addons / adopted-ember-addons/ember-paper

paper-chips component throws an error while executing inputFocus action

Aberta
#606 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
879
Forks
327
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

The issue can be reproduced on the demo page containing [paper-chips](http://miguelcobain.github.io/ember-paper/release-1/#/components/chips) examples.

When we fill any value in the 'Default template' example and focus out of the input and then focus back again, an error is thrown:
`Uncaught TypeError: Cannot read property 'close' of undefined`

It seems that this statement is not guarded properly: https://github.com/gpluta/ember-paper/blob/master/addon/components/paper-chips.js#L77

the `autocomplete` param is an object with an 'actions' prop when the `inputFocus` action is called from the `paper-chips-autocomplete` component. Otherwise it is a string containing the value enered in the input.

The if () {} condition should contain a check if the `actions` prop is available on `autocomplete` parameter. It should look like:

```js
if (isPresent(autocomplete) && autocomplete.actions) {
autocomplete.actions.close();
}
```

Can I create a PR for this little fix? Am I missing something important?

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.