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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/value change action #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jdurand
Copy link
Contributor

@jdurand jdurand commented Apr 11, 2018

This PR makes sure an onChange event (#18) is sent & the value is set only of a user interaction caused the value to change (see: https://github.com/mrgrain/colpick bySetColor flag).

This also allows the component to be used in a data-down/actions-up way (without 2-way binding on value).

// components/col-pick-button.js
import Component from '@ember/component';
import ColPickMixin from 'ember-colpick/mixins/col-pick';

export default Component.extend(ColPickMixin, {
  flat: false
});
{{!-- hello.hbs --}}
{{#col-pick-button value=(unbound record.color) onChange=(action 'colorUpdated' record)}}
  Hello
{{/col-pick-button}}

Without this, the component is exposed to some unpredictable 2-way binding side-effects; combine this and WebSocket updates and you may get XMas tree lights on your production app 馃槄.

I'm running this branch in production BTW:

3a78115eb1231c015ce9b58be77f1ef2

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

1 participant