meteor-autocomplete
meteor-autocomplete copied to clipboard
Broken server side subscription on Meteor 2.0
What
The client collection gets fed with results and the results accumulate. So we have 5 entries (for example) at the first letter input, then when the second letter is typed in, we have 10 entries in the client collection. The client-side of the code displays everything it has in the collection, therefore the autocomplete doesn't work. It looks like the _publishCursor doesn't purge the collection every time it's updated.
Reproduction
- [ ] Run Meteor 2.0 with meteor-autocomplete (last commit of master branch) and server-side subscription.
Here is what the code looks like on the server:
Meteor.publish("autocompleteMyCollection", function(selector, options) {
Autocomplete.publishCursor(MyCollection.find(selector, options), this);
this.ready();
});
@StorytellerCZ Have you encounter anything like this?
@jankapunkt is probably the better person to ask.
Thanks, @StorytellerCZ. It really looks like the .stop() function is not clearing the collection. Might be a Meteor issue? @jankapunkt
Hi @aessig @StorytellerCZ ,
I currently develop autocomplete for AutoForm but it's generic and not bound to this package (but can be used with this package). I actually am not very deep into this package so I can't really help (I also have always big trouble understanding cofeescript...).
@aessig do you use some package or technique to cache subscriptions like kadira SubsManager or ccorcos SubsCache?
Thanks for this quick reply. No, I don't use any subs manager. If you have an alternative for AutoForm, it might be a solution too. Is it based also on pub/sub or methods? Do you have anything public?
Regarding AutoForm: this is simply the ui and form component (the input field + some rendering) but you have to provide the autocomplete options on your own (so it is compatible with any implementation) so I think this won't be an alternative. You can check the latest PR on it.
Thanks @jankapunkt. I will have a look.