Food Input, a repeater and a loading issue

Hi,
I am having problems with my page. I tried so many times to amend this but unable to solve this. My aim is for clients to search for food items but the page takes a long time to load. I have minimised the page to a repeater, some text, input text, header and no photos. was wondering whether it is the code issue. Please help thanks. The code is as follows:


import wixData from ‘wix-data’;
let listSize;
let currIndex = -1;
let debounceTimer;
$w.onReady(function () {
$w(‘#SearchInput’).onKeyPress((event) => {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
if ($w(‘#SearchInput’).value.length === 0) {
currIndex = -1;
$w(“#repeaterDropdown”).collapse()
.then(() => {
console.log(“Done with collapse”);
});
currIndex = -1;
}

});
wixData.query("FoodCompositionTable")
    .contains("foodItemName", $w('#SearchInput').value)
    .limit(10)
    .find()
    .then((res) => {
        $w('#repeaterDropdown').data = [];
        $w('#repeaterDropdown').data = res.items;
        listSize = res.items.length;
        $w('#repeaterDropdown').expand();
    }, 10)

}
);
});

export function repeaterDropdown_itemReady($item, itemData, index) {
$item(‘#ItemName’).text = itemData.foodItemName;
$item(‘#container2’).onClick(() => {
$w(‘#SearchInput’).value = itemData.foodItemName;
$w(‘#repeaterDropdown’).collapse();

});

}


Would appreciate if you could look through the code and check whether there is a problem with it.

Thanks

The quickest way for you to check is to temporally remove parts of your code and see if removing the code improves loading time

Our salt-free butter is true art for your kitchen. Produced with love and care for every detail, President Unsalted Butter is the perfect choice for those who appreciate naturalness and unrivalled quality. We use only the freshest and finest cream, sourced from carefully selected farmers. With no added salt, our butter gives you complete freedom of choice, allowing you to control the precise flavour and saltiness of every dish you cook.