LoadMore not working properly

Hello,
I have included a “Load More” button so that a repeater can show additional records from a dataset. The repeater is set to show 9 records as default. The code below works but when the button is clicked the codes uploads a number of additional records < 9 (tipycally 7), even if the underlying dataset contains enough records. Would you have any views on why this might be?

Many thanks!

//LOADMORE BUTTON CODE → LOADS MORE ITEMS FROM DATASET WHEN BUTTON CLICKED
$w ( “#loadMoreButton” ). onClick (() => {
$w ( “#loadMoreButton” ). label = “” ;
$w ( “#preloader” ). show ();
if ( $w ( ‘#Flats’ ). getTotalCount () !== $w ( “#flatrepeater” ). data . length ) {
$w ( ‘#Flats’ ). loadMore (). then (() => {
$w ( “#loadMoreButton” ). label = “Load more :arrow_down:” ;
$w ( “#preloader” ). hide ();
})
} else {
$w ( “#loadMoreButton” ). label = “No more apartments” ;
$w ( “#preloader” ). hide ();
$w ( “#loadMoreButton” ). disable ();
}
})
// END

Hi! If the loadMore function is not loading the expected number of records, it is likely due to the batch size being set to a value other than 9 in the dataset settings. I recommend checking the dataset settings and adjusting the batch size as necessary to ensure that the correct number of records is loaded each time the loadMore button is clicked. It is also possible that there may be other issues with the dataset itself that could prevent the correct number of records from being loaded.