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

Glimmer and mut helper not working #120

Closed
luxzeitlos opened this issue Dec 8, 2016 · 6 comments
Closed

Glimmer and mut helper not working #120

luxzeitlos opened this issue Dec 8, 2016 · 6 comments

Comments

@luxzeitlos
Copy link

This worked fine in ember 2.8.x, but not in 2.10.0:

{{pikaday-input onSelection=(action (mut foo))}}
<br>
{{foo}}

The expected behavior is that the date can be selected and then is stored in the variable foo and so displayed.

When used with ember 2.10, so glimmer, the variable foo gets set back to null immediately.

This can be reproduced on a fresh ember-cli project with "ember-pikaday": "2.2.0",.

@duizendnegen
Copy link
Contributor

What happens in the case you use (action 'myAction)? Intuitively I'd say the onSelection action gets fired twice, but I'd have to investigate.
Would also appreciate a slimmed down Ember Twiddle showing just that.

@luxzeitlos
Copy link
Author

Doesn't get fired twice. Tried that. A normal action is called as expected.

I wasn't able to get ember-pikaday running in a twiddle at all. Can provide a git repo tho, if this would help.

@duizendnegen
Copy link
Contributor

That'd surely help - when you add an observer to foo, does that get fired twice, or just set once (to null)?

@luxzeitlos
Copy link
Author

here is a repo.
And an observer does get fired twice.

Okay, I figured out that the second onSelection gets fired because of this code. Ember.isEmpty(this.$().val()) does evaluate to true, so the this.get('onSelection')(null); is evaluated.

So the difference is:

  • When using onSelection=(action "mutFoo") the input already contains the date when onPikadayClose runs,
  • and when using onSelection=(action (mut foo) the input is still empty.

Thats odd because a component should not see a difference!

@luxzeitlos
Copy link
Author

Okay, I identified the underlaying problem.

Basically in ember 2.10 calling a mut helper will result in triggering didUpdateAttrs.
here is a repo for reproduction.

However this seems fixed on canary and beta. Not sure what to do now. Wait for a hotfix?

Maybe this is related?

@duizendnegen
Copy link
Contributor

duizendnegen commented Dec 9, 2016

Yea, if it's fixed on canary and beta I'd rather wait for a 2.10.x bug-fix release to come out to be honest. I'll try and ping some people on the Ember.js team to see what's the schedule for that.

Edit: bug fixes come out on Mondays, so it should be fixed in 2.10.1. Closing this, feel free to re-open if still prevalent in 2.10.1.

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

No branches or pull requests

2 participants