why is my website super slow to load?

really slow to load, unreasonably slow. please don’t share the basic “how to make your site load faster”, I think it’s something deeper. can a wix person help here, maybe look at the site’s configuration or something?
www.garimd.com
thanks

You have dozens of items in a repeater which makes to slow.
I hope Wix will improve the re[eater performance asap.
Meanwhile you have 2 options:

  1. to build a repeater of your own using custom element (if you do it right it’ll be really fast. But it’s more complicated than the average Corvid script).

  2. To bind the data to the repeater in portions. For example, bind the first 5 items, then wait 2 seconds and bind 5 more etc… this way the user will see the first 5 first and won’t have to wait for the full repeater to populated.

can you guide the way? is there a wix tutorial for this?
I think for the moment I’ll focus on option “2”…

First you get the data from the collection or the dateset (do not connect it to the repeater via the editor). Then when you have the items you can do something like:

let i = 5;
let intervalInSeconds = 2;
const dataBindingInterval = setInterval(() => {bindData()}, 1000 * intervalInSeconds);
function bindData(){
let data = items.slice(0, i);
$w("#repeater1").data = data;
i += 5;
if(data.length >= items.length) {clearInterval(dataBindingInterval);}
}

I tried to do it, but I have several questions:
1.
How to limit the number of items to load? I use this inside the " $w.onReady":

.
.
.
$w("#repeater1").onItemReady(($item, itemData, inx) => {

 // bind data from dataset with code (faster then editor)
        $item("#textName").text = itemData.firstName;
        $item("#textMaxPrice").text = String(itemData.maxPrice); 
        $item("#textFreeText").text = itemData.freeText; 
        $item("#textCity").text = itemData.city; 
.
.
.

and this seems to load all items.
Limiting items to load via dataset in the editor is not working.

Should I use your function inside “$w.OnReady” or elsewhere?

It looks like my website is still very slow, even when I click the “contact” page, which doesn’t load any database. Could something else be improved in the website?

any answer?

  1. I’m not sure what you’re asking. Every 5 seconds it binds another 5 items to the repeater.

  2. Yes. The const dataBindingInterval line should be in $w.onReady(). The other lines can be either outside or inside.

  3. So go for the custom element solution.

@jonatandor35

  1. The repeater loads all results from dataset, not binding them by groups.
    You can see the webpage here: https://www.garimd.com/
    Can you explain how to combine the repeater’s “OnItemReady” with “$w.OnReady”?

  2. What are the “items” in your code?

  3. custom element is above my coding level…

  1. You should disconnect the repeater from the dataset on the editor.

  2. The items in my code are the items that you retrieve by code from the dataset (not specified in the code above). Something like:

let dataBindingInterval, items, i = 5, intervalInSeconds = 3;
$w.onReady(() => {
$w("#dataset1").onReady(() => {
$w("#dataset1").getItems(0, 1000)
.then(res=> {
items = res.items;
dataBindingInterval = setInterval(bindData, 1000 * intervalInSeconds);
})
$w("#repeater1").onItemReady(($i, iData) => {
$i("#textCity).text = iData.city;
$i("#maxPrice").text = "עד מחיר (ש"ח):" + iData.maxPrice;
//etc... bind the data to the repeater elements
})
$w("#contactButton").onClick(event => {
let $item = $w.at(event.context); 
let itemData = $w("#repeater1").data.find(e => e._id === event.context.id);
 $item("#contactInfo").text = itemData .contactInfo;
})
})
})
function bindData(){
let data = items.slice(0, i);
$w("#repeater1").data = data;
i += 5;
if(data.length >= items.length) {clearInterval(dataBindingInterval);}
}

(I fixed an err)

@jonatandor35 I can’t understand what this code does, and can’t manipulate it as needed, so I’m asking for more help:
After applying the code the webpage is showing the repeater’s default text while loading (doesn’t look good),
then showing all results,
then showing only last 5 results and not loading more.

Any advice?
(right now it’s back to the older code version)

Asaf,
This code retrieves all the items from the dataset, then:

  1. It binds the first 5 items to the repeater. Then (after 3 seconds):

  2. It binds the first 10 items (5 of them them already bound), Then (after another 3 seconds):

  3. It binds the first 15 items (10 of them them already bound)… etc…