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

improve doc for filter CP #14605

Merged
merged 1 commit into from
Feb 24, 2017
Merged

improve doc for filter CP #14605

merged 1 commit into from
Feb 24, 2017

Conversation

Leooo
Copy link
Contributor

@Leooo Leooo commented Nov 14, 2016

Was really not obvious to me before that the dependentKey for a filter CP could be anything different than the array used to filter.

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Maybe we can give both examples? I think the example that exists now is probably the more common scenario so we should just give both...

@Leooo
Copy link
Contributor Author

Leooo commented Nov 14, 2016

@rwjblue amended

@@ -278,6 +278,28 @@ export function mapBy(dependentKey, propertyKey) {
hamster.get('remainingChores'); // [{name: 'write more unit tests', done: false}]
```

You can also use `@each` in your dependent key, the callback will still use the underlying array:
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 I'm a bit concerned people will hurriedly read and start using chores.@each (for example) without the leaf property. Maybe @each.property? Maybe it's not a concern.

Copy link
Member

Choose a reason for hiding this comment

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

@locks - FYI chores.@each works properly without deprecation as of #12848 (landed in 2.5.0).

@Leooo
Copy link
Contributor Author

Leooo commented Nov 14, 2016

@locks right, amended

{ name: 'write more unit tests', done: true }
]
});
hamster.set('done', false);
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this setting? should the example be to set the last item of chores as done: false? or perhaps just remove the set example and define one of the chores to have done: false in the call to Hamster.create

@locks
Copy link
Contributor

locks commented Dec 8, 2016

@Leooo hi, if you need help addressing @pixelhandler's comments let us know! Let's get this merged :D

@Leooo
Copy link
Contributor Author

Leooo commented Dec 8, 2016

@locks didn't see @pixelhandler 's comment, on it thanks

@Leooo
Copy link
Contributor Author

Leooo commented Dec 8, 2016

@locks @pixelhandler better? I tested the last example, thanks for spotting the issue

])
});
hamster.get('remainingChores'); // [{name: 'write more unit tests', done: false}]
hamster.get('chores')[2].set('done', true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe change this for hamster.get('chores').objectAt(2).set('done', true);?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@locks done thanks

@locks
Copy link
Contributor

locks commented Dec 9, 2016

@Leooo thank you for your work! :) Can you squash the commits for us, and I'll get rwjblue to re-review your PR?

@Leooo
Copy link
Contributor Author

Leooo commented Dec 9, 2016

@locks @rwjblue done thanks

@rwjblue rwjblue merged commit 79d7dea into emberjs:master Feb 24, 2017
@rwjblue
Copy link
Member

rwjblue commented Feb 24, 2017

Thank you!

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.

4 participants