Open juwara0 opened 7 years ago
Refactor typeOf helper: https://github.com/ciena-frost/ember-frost-info-bar/blob/878af21e138ade8f5649d14d7df1377186783f84/addon/helpers/type-of.js#L8-L13
Currently, this helper only gets executed once. If the bound property value changes this helper does not get executed again since it does not have a recompute method implemented. See: https://github.com/ciena-frost/ember-frost-object-browser/blob/1caa762b465b4ad042f81d882898a6859c9975a4/addon/helpers/single-select.js#L10-L27
This should really be a component-detector helper. Currently, this assumes that all objects passed in are components: https://github.com/ciena-frost/ember-frost-info-bar/blob/878af21e138ade8f5649d14d7df1377186783f84/addon/templates/components/frost-info-bar.hbs#L11 For example, if an array is passed in typeof will evaluate that to an "object" type.
objects
array
typeof
"object"
For item 2 above, if we were to use Ember.typeOf(), although not ideal, we could then compare it against the value type of "instance".
Ember.typeOf()
"instance"
A better solution would be to detect that it is a component. Something like this logic implementation: https://github.com/ciena-blueplanet/ember-prop-types/blob/138773c064f7954727aaff7c44a9c0f61a315c47/addon/utils/validators/ember-component.js#L12-L18
Problem Description
Refactor typeOf helper: https://github.com/ciena-frost/ember-frost-info-bar/blob/878af21e138ade8f5649d14d7df1377186783f84/addon/helpers/type-of.js#L8-L13
Currently, this helper only gets executed once. If the bound property value changes this helper does not get executed again since it does not have a recompute method implemented. See: https://github.com/ciena-frost/ember-frost-object-browser/blob/1caa762b465b4ad042f81d882898a6859c9975a4/addon/helpers/single-select.js#L10-L27
This should really be a component-detector helper. Currently, this assumes that all
objects
passed in are components: https://github.com/ciena-frost/ember-frost-info-bar/blob/878af21e138ade8f5649d14d7df1377186783f84/addon/templates/components/frost-info-bar.hbs#L11 For example, if anarray
is passed intypeof
will evaluate that to an"object"
type.Possible Solution
For item 2 above, if we were to use
Ember.typeOf()
, although not ideal, we could then compare it against the value type of"instance"
.A better solution would be to detect that it is a component. Something like this logic implementation: https://github.com/ciena-blueplanet/ember-prop-types/blob/138773c064f7954727aaff7c44a9c0f61a315c47/addon/utils/validators/ember-component.js#L12-L18