I use this article to create infinite scroll and this is my client and server code:
// server-side
Meteor.publish('getContactUsMessages', function(limit) {
if (limit > ContactUsMessages.find().count()) {
limit = 0;
}
return ContactUsMessages.find({ }, { limit: limit });
});
// client-side
incrementLimit = function(inc) {
inc = inc || 2;
newLimit = Session.get('limit') + inc;
Session.set('limit', newLimit);
};
When I increase the limit of the find, is it going to re-fetch all the data, including the data that you already had, or does it fetch only the additional data that is needed?
Only the new data. You can confirm this for yourself by using your browser's inspector to look at the network traffic that occurs when you increase the limit.