For anyone who finds this and is interested, I did some more digging and found that it’s not really an ember-bootstrap
issue, but an issue in how unbound
seems to behave in certain scenarios. Or, maybe an issue in how properties get passed between components.
It’s not really clear to me from the docs that this would be the behavior, but it is.
This works like I’d expect
{{#with (unbound model) as |unboundModel|}}
<!-- this is properly unbounded and does not update -->
{{input value=unboundModel.name}}
{{/with}}
This does not work like I’d expect
// The component
import Ember from 'ember';
export default Ember.Component.extend({
output: Ember.computed('input', function () {
return this.get('input');
})
});
// Using an unbound property with the component
{{#with (unbound model) as |unboundModel|}}
<!-- unboundModel is unbound -->
{{#some-component input=unboundModel as |output|}}
<!-- output.name is bound to model and will update -->
{{output.name}}
{{/some-component}}
{{/with}}
It appears that when the unbound property is assigned as a parameter to the component, the component’s instance/reference to that property is somehow bound to model
.
I think the reason that behavior is confusing to me is that (in my mind at least) the unboundModel
should be disconnected from updates upstream, and so should anything downstream from unboundModel
.
… essentially freezing its value at the moment of rendering …
I don’t know enough about how properties are passed around under the hood to understand why it works like it does. There’s probably a line of reasoning where this behavior makes sense, but as someone coming from the angle of “this thing is unbound, so if I use this thing in a component, properties derived from it shouldn’t update” it was a little weird to figure out.