-
Notifications
You must be signed in to change notification settings - Fork 6
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
Changing filters reactively #10
Comments
try this: this.cursor(Meteor.users.find(this.userId, { limit: 1 }), function(id, doc) {
if (doc.filters) {
this.cursor(Products.find(doc.filters));
}
}); the problem can be when a different field is updated in the user, then if you update for example the username The previous behavior is the expected because you only want to restart the products query when changing the According to the above, the following code can also work, since only receive updates when this.cursor(Meteor.users.find(this.userId, { limit: 1, fields: {filters: 1} }), function(id, doc) {
this.cursor(Products.find(doc.filters));
}); |
Ohh ok, I didn't understand that from the docs but anyway I was only changing the filters and I ended up |
check the update you are doing on the user, I'm not quite sure how to help there :S |
First of all, the package looks great!
I know this is a weird error and I'll give you two very similar scripts, the first one works, the second doesn't.
In this case, the publication takes in the filters by which it searches the products.
This works as expected.
In this other case, the filters get read from the user document. I update the user's filters via a Meteor.method and they are updated correctly. This publish gives the correct products to the client, but upon changing filters, those products that did much and now doesn't, don't get removed and also don't get updated reactively when they change.
Everything gets fixed when refreshing the page so this looks related to the users collection. Does it behave differently from a normal collection?
Any ideas? Hope this helps.
The text was updated successfully, but these errors were encountered: