Conditional statement to update repeater stops working after first run

Hi all,

Facing a strange issue with the code below. What I am trying to do is go through every item in a repeater that is connected to my products dataset and show different text boxes based on a condition.

The problem appears after performing any action after the first load of the page, when the below code performs as expected. As soon as an onViewportEnter event to loadmore from the dataset triggers, the evaluation runs, but it stops changing the selected item from the repeater; it just evaluates the same item over and over again for 90% of the time, then randomly chooses another item to evaluate, before going back to the first item.

I am pretty sure it is because of how I am using onReady, forEachItem and onItemReady to trigger the below code, but I am not sure what I am doing wrong.

The page where the console can be checked is:
www. virgovintage .ro/new-page2

export function repeater1_itemReady(event) {
$w("#dataset6").onReady( () => {
$w("#repeater1").forEachItem( ($w) => {
$w("#repeater1").onItemReady( ($w) => { 
let price = $w("#dataset6").getCurrentItem().price;
let discountedPrice = $w("#dataset6").getCurrentItem().discountedPrice;
    if (discountedPrice < price) {
        console.log(discountedPrice - price)
        $w("#text18").hide()
        $w("#text111").show()
        $w("#text112").show()
        $w("#text113").show()     
    }
    else {console.log(discountedPrice - price)
        $w("#text18").show()
        $w("#text111").hide()
        $w("#text112").hide()
        $w("#text113").hide() 
      }
      console.log(discountedPrice < price)
$w("#text112").html = `<div style="text-align: right; font-family: Avenir Light;font-size: 20px;letter-spacing: 0.1em; color:red; text-decoration: line-through;">${$w("#text112").text}</div>`;
$w("#text113").html = `<div style="text-align: left; font-family: Avenir Light;font-size: 20px;letter-spacing: 0.1em; color:red; text-decoration: line-through;">${$w("#text113").text}</div>`;
    
    })})})}

You should never put dataset.onReay inside repeater.onItemReady.