How does collection pagination works?

I’m implementing a lazy loading system, and here’s what I’ve done so far:

  1. I set up a variable with an initial value of 5, which controls the number of items loaded in the collection using pagination.

  2. In the page-level workflow, I check if the user has scrolled to the bottom.

  3. When that happens, I increase the variable by 5 and fetch the collection again.


However, I’m wondering how this actually works:
Does it fetch all the data again from the start, or does it keep the previously loaded items and only fetch the next batch?

I want to make sure that as I reach for example 100+ items, the system doesn’t crash by repeatedly fetching all items instead of just loading new ones.