Meteor-Community-Packages / meteor-autocomplete

Client/server autocompletion designed for Meteor's collections and reactivity.
https://atmospherejs.com/mizzao/autocomplete
MIT License
350 stars 109 forks source link

Broken server side subscription on Meteor 2.0 #154

Open aessig opened 3 years ago

aessig commented 3 years ago

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

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();
});
aessig commented 3 years ago

@StorytellerCZ Have you encounter anything like this?

StorytellerCZ commented 3 years ago

@jankapunkt is probably the better person to ask.

aessig commented 3 years ago

Thanks, @StorytellerCZ. It really looks like the .stop() function is not clearing the collection. Might be a Meteor issue? @jankapunkt

jankapunkt commented 3 years ago

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?

aessig commented 3 years ago

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?

jankapunkt commented 3 years ago

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.

aessig commented 3 years ago

Thanks @jankapunkt. I will have a look.