meteor-autocomplete icon indicating copy to clipboard operation
meteor-autocomplete copied to clipboard

Broken server side subscription on Meteor 2.0

Open aessig opened this issue 4 years ago • 7 comments

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();
});

aessig avatar Feb 20 '21 17:02 aessig

@StorytellerCZ Have you encounter anything like this?

aessig avatar Feb 20 '21 17:02 aessig

@jankapunkt is probably the better person to ask.

StorytellerCZ avatar Feb 21 '21 19:02 StorytellerCZ

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

aessig avatar Feb 21 '21 19:02 aessig

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?

jankapunkt avatar Feb 22 '21 08:02 jankapunkt

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?

aessig avatar Feb 22 '21 08:02 aessig

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.

jankapunkt avatar Feb 22 '21 08:02 jankapunkt

Thanks @jankapunkt. I will have a look.

aessig avatar Feb 22 '21 16:02 aessig