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

Make functions returned "real" actions. #8

Merged
merged 2 commits into from
Feb 5, 2016

Conversation

rwjblue
Copy link
Contributor

@rwjblue rwjblue commented Feb 5, 2016

This prevents the extra/double mutable object wrapping when passing down from one layer to the next (and avoids requiring extra (action wrapping to prevent this).

Given the following:

{{! app/templates/route-template.hbs }}

{{parent-component go=(route-action 'foo')}}
{{! app/templates/components/parent-component.hbs }}

{{child-component go=go}}

Prior to this change, child-component would get a mutable object in this.attrs.go instead of the invokable function (to work around this you would have to continue to wrap with (action either via {{child-component go=(action go)}} or {{parent-component go=(action (route-action 'foo'))}}).

After this change, this.attrs.go() Just Works™.

This prevents the extra/double mutable object wrapping when passing down
from one layer to the next (and avoids requiring extra `(action`
wrapping to prevent this).
This was implemented in the normal `(action` helper in
emberjs/ember.js#12519.
@poteto
Copy link
Collaborator

poteto commented Feb 5, 2016

Excellent! LGTM

@rwjblue
Copy link
Contributor Author

rwjblue commented Feb 5, 2016

Looks like Travis finally finished all of @martndemus's jobs 😝

@ghost
Copy link

ghost commented Feb 5, 2016

I'm sorry 🙃

@poteto
Copy link
Collaborator

poteto commented Feb 5, 2016

@homu r+

@homu
Copy link
Contributor

homu commented Feb 5, 2016

📌 Commit 5c0fa72 has been approved by poteto

@homu
Copy link
Contributor

homu commented Feb 5, 2016

⚡ Test exempted - status

@homu homu merged commit 5c0fa72 into DockYard:master Feb 5, 2016
homu added a commit that referenced this pull request Feb 5, 2016
Make functions returned "real" actions.

This prevents the extra/double mutable object wrapping when passing down from one layer to the next (and avoids requiring extra `(action` wrapping to prevent this).

Given the following:

```hbs
{{! app/templates/route-template.hbs }}

{{parent-component go=(route-action 'foo')}}
```

```hbs
{{! app/templates/components/parent-component.hbs }}

{{child-component go=go}}
```

Prior to this change, `child-component` would get a mutable object in `this.attrs.go` instead of the invokable function (to work around this you would have to continue to wrap with `(action` either via `{{child-component go=(action go)}}` or `{{parent-component go=(action (route-action 'foo'))}}`).

After this change, `this.attrs.go()` Just Works™.
kevinansfield added a commit to kevinansfield/Ghost that referenced this pull request Feb 6, 2016
no issue
- cleans up passing route closure actions down through components and ensures callbacks are wrapped in the runloop - DockYard/ember-route-action-helper#8
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

3 participants