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

Add connectFilter mixin #222

Merged
merged 1 commit into from Feb 4, 2015
Merged

Add connectFilter mixin #222

merged 1 commit into from Feb 4, 2015

Conversation

KyleAMathews
Copy link
Contributor

Similar in usage to the connect mixin except it allows you to pass in
a filterFunction to filter items from your store before they get passed
on.

Similar in usage to the `connect` mixin except it allows you to pass in
a filterFunction to filter items from your store before they get passed
on.
@spoike
Copy link
Member

spoike commented Feb 4, 2015

👍

@spoike spoike added this to the 0.2.5 milestone Feb 4, 2015
spoike added a commit that referenced this pull request Feb 4, 2015
@spoike spoike merged commit a6e7917 into reflux:master Feb 4, 2015
@spoike
Copy link
Member

spoike commented Feb 4, 2015

Thanks!

var PostView = React.createClass({
mixins: [Reflux.connectFilter(postStore,"post", function(posts) {
posts.filter(function(post) {
post.id === this.props.id;
Copy link
Contributor

Choose a reason for hiding this comment

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

am I wrong or are one or two return statements missing here?

Copy link
Member

Choose a reason for hiding this comment

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

Yup... nice catch.

I've been having too much coffeescript lately to notice. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heh, that was my problem too.
On Mon, Feb 16, 2015 at 11:25 PM Mikael Brassman notifications@github.com
wrote:

In README.md
#222 (comment):

@@ -501,6 +501,27 @@ var Status = React.createClass({
});


+#### Using Reflux.connectFilter
+
+`Reflux.connectFilter` is used in a similar manner to `Reflux.connect`. Use the
+`connectFilter` mixin when you want only a subset of the items in a store. A
+blog written using Reflux would probably have a store with all posts in
+it. For an individual post page, you could use `Reflux.connectFilter` to
+filter the posts to the post that's being viewed.
+
+```javascript
+var PostView = React.createClass({
+    mixins: [Reflux.connectFilter(postStore,"post", function(posts) {
+        posts.filter(function(post) {
+           post.id === this.props.id;

Yup... nice catch.

I've been having too much coffeescript lately to notice. [image: 👍]


Reply to this email directly or view it on GitHub
https://github.com/spoike/refluxjs/pull/222/files#r24797357.

Copy link
Contributor

Choose a reason for hiding this comment

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

seems to be fixed now by #240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants