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

[BUGFIX beta] {{get}} helper subscribes to values and can be updated #11691

Merged
merged 1 commit into from
Jul 16, 2015

Conversation

jmurphyau
Copy link
Contributor

This PR fixes two issues:

1: When using the {{get}} helper it sometimes wouldn't update correctly.

Because a helper and a keyword are being used, Ember is invoking the helper logic and wrapping the stream the get keyword creates in a BuiltInHelperStream - it also would not subscribe the morph to the stream. This subscription is where the error lies.

To fix this the helper has been removed and only keyword logic is implemented.

2: It was previously not possible to use the {{input}} helper with the {{get}} helper

This functionality has now been added using the mut keyword, e.g:

{{input value=(mut (get source path)) type='text'}}

This should help with making progress on #4619.

view = EmberView.create({
context: context,
container: container,
template: compile('{{input id=\'get-input\' type=\'text\' value=(mut (get source \'banana\'))}}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use back ticks instead of single quotes?

`{{input id='get-input' ...}}`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep will do

@jmurphyau jmurphyau force-pushed the new-get-helper-as-keyword branch 6 times, most recently from ff1ca3e to 37a39a4 Compare July 9, 2015 00:08
@rwjblue
Copy link
Member

rwjblue commented Jul 16, 2015

Any updates here?

@jmurphyau
Copy link
Contributor Author

This should be good to go.. @mmun?

Just need to document it..

@mmun
Copy link
Member

mmun commented Jul 16, 2015

I will merge this but I'm a little sad how complicated it has to be right now. Needs a rebase.

@mmun mmun self-assigned this Jul 16, 2015
This commit fixes two issues:

1. When using the {{get}} helper it sometimes wouldn't update correctly.

Because a helper and a keyword are being used, ember is invoking the helper logic and wrapping the stream the get keyword creates in a BuiltInHelperStream - it also would not subscribe the morph to the stream. This subscription is where the error lies.

To fix this the helper has been removed and only keyword logic is implemented.

2. It was previously not possible to use the {{input}} helper with the {{get}} helper - this functionality has now been added using the mut keyword, e.g:

{{input value=(mut (get source path)) type='text'}}
@jmurphyau
Copy link
Contributor Author

Rebase done. @mmun is there anything I should do to make it less complicated?

@mmun
Copy link
Member

mmun commented Jul 16, 2015

It would require an HTMLBars refactor. Sauce failed, I'll restart it.

mmun added a commit that referenced this pull request Jul 16, 2015
[BUGFIX beta] {{get}} helper subscribes to values and can be updated
@mmun mmun merged commit 5226849 into emberjs:master Jul 16, 2015
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.

3 participants