Repeater firing twice when input changes

Repeater is executing twice when input has changed.

Here is the following code:

function modifyRepeater(passInput, airportInput) {
    console.log("outside scope");
    $w("#repeater1").onItemReady(($item, itemData, index) => {
        console.log("inside scope");
        checkPlanePrice(itemData, passInput, airportInput)
        .then((items)=> {
        var price = items;
        if(price)
            $item("#repeaterPrice").text = price;
        else
            $item("#repeaterPrice").text = "nil";
        if(index === $w("#repeater1").data.length -1)
            $w("#LoadingStrip").hide();
        });
});

Thanks!

How and where is modifyRepeater() called? Is the Repeater connected to a Dataset, or is the Repeater data property being changed in code?

The onItemReady() event handler is triggered when the contents of the Repeater have been changed, and should be set in the page’s onReady() event handler.

It is being called in whenever there is changes made to input which would update the repeater.
The repeater is connected to a dataset, and modifyRepeater() is just updating the price of that particular repeater.
I have a madeRepeater() function that is called in onReady().

Basically, I just want to modify the value of $item ( #repeaterPrice ). text

Is there a better way of doing this, or do I need to loop through all of it again?

@samuellmkit If you want to change #repeaterPrice on all of the Repeater items, then yes, you will need to loop through all of them. If you only want to change #repeaterPrice on one Repeater item, then you can just change according to the appropriate Repeated Item Scope .

For more information regarding Repeaters with input elements and modifying a specific Repeater item, see the following examples:

Thanks a lot, I will look into it! Cheers!

Samuel, you should not set the onItemReady handler more than ONE TIME.
This single listener will automatically fire every time you update the repeater data.