Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data down actions up. #66

Closed
wants to merge 2 commits into from
Closed

Data down actions up. #66

wants to merge 2 commits into from

Conversation

arenoir
Copy link

@arenoir arenoir commented May 10, 2015

This pr changes the functionality of this addon significantly. It removes the value attribute and changes selected to read only.

At first I attempted to allow both "two way binding" or "oneway with actions" but failed to come up with a elegant way to differentiate between the two.

Personally I have come to the conclusion that the component should not mutate the object but only send actions and if I want the component to mutate a property I should wrap the component in another component and implement the mutation there.

Refactor code to use `value` instead of `selection`.
Now component can two way bind on the `value` property or send actions
up and data down using the `selection’ property.
…ntent changes.

I have decided using the data down actions up paradigm to be more
manageable.

change `selection` property to oneWay.
remove `value` property.
@miguelcobain
Copy link
Owner

@arenoir, please read the discussion in this PR and on this topic.

Bottom line is that "Data down actions up" doesn't apply to every case.
Ember 2.0 will have primitives to allow components to change data that is passed in: <my-video paused={{mut isPaused}}></my-video>. Note the mut (mutable) part.

Also, even React allows these kind of things.

Think about a long form with many selects. It would very cumbersome to write an action to each select instance. I think it would be a step backwards.
However, like @sandstrom mentioned here, there are some cases where an action is more appropriate.

I believe that this component would lose a lot of its usefulness if it only supports "Data down actions up" paradigm. I'm open for discussion, of course.

@arenoir
Copy link
Author

arenoir commented May 12, 2015

Yes I agree there are cases for two way bindings and form elements are usually a good case. So until we can specify a property as mutable perhaps there should be an additional property to flag it as such isSelectionMutable?

@miguelcobain
Copy link
Owner

That would be in line with #53.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants