Hello, please help me with this problem: Why does the button to delete the item from the repeater not work at the first onClick, and after clicking it, it performs the function once more?
export function deleteItinerary_click(event) {
$w("#repeater3").forEachItem(($item, itemData, index)=> {
$item("#deleteItinerary").onClick (()=>{
product_name= itemData.myPlacesListName;
let userId = user.id;
wixData.query("myItinerary")
.eq("userId", userId)
.eq("myPlacesListName", product_name)
.find()
.then((results) => {
let items = results.items;
let firstItem = items[0];
wixData.remove("myItinerary", firstItem._id).then( () => {
getfilters2();
console.log("borrado de itinerario")
});
})
})
})
}