b24
b24

Reputation: 2473

Infinite scroll in meteor.js

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?

Upvotes: 0

Views: 923

Answers (1)

Michel Floyd
Michel Floyd

Reputation: 20226

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.

Upvotes: 2

Related Questions