# why is my website super slow to load?

**URL:** <https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [November 27, 2020, 4:16pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109 "2020-11-27T16:16:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathgalago](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mathgalago/32/23932_2.png) [@mathgalago](https://forum.wixstudio.com/u/mathgalago)\
**Post date:** [November 27, 2020, 4:16pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/1 "2020-11-27T16:16:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [November 28, 2020, 7:17pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/2 "2020-11-28T19:17:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mathgalago](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mathgalago/32/23932_2.png) [@mathgalago](https://forum.wixstudio.com/u/mathgalago)\
**Post date:** [November 28, 2020, 8:04pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/3 "2020-11-28T20:04:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [November 28, 2020, 8:18pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/4 "2020-11-28T20:18:50Z")

</div>

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:

```javascript
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);}
}

```

---

<div class="post-metadata">

**Author:** ![mathgalago](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mathgalago/32/23932_2.png) [@mathgalago](https://forum.wixstudio.com/u/mathgalago)\
**Post date:** [December 24, 2020, 6:20am UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/5 "2020-12-24T06:20:15Z")

</div>

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":

```javascript
.
.
.
$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.

1. 

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

1. 

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?

---

<div class="post-metadata">

**Author:** ![mathgalago](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mathgalago/32/23932_2.png) [@mathgalago](https://forum.wixstudio.com/u/mathgalago)\
**Post date:** [December 28, 2020, 3:56pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/6 "2020-12-28T15:56:16Z")

</div>

any answer?

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [December 28, 2020, 4:09pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/7 "2020-12-28T16:09:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mathgalago](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mathgalago/32/23932_2.png) [@mathgalago](https://forum.wixstudio.com/u/mathgalago)\
**Post date:** [December 28, 2020, 7:51pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/8 "2020-12-28T19:51:44Z")

</div>

@jonatandor35

1. The repeater loads all results from dataset, not binding them by groups.  
You can see the webpage here: [https://www.garimd.com/](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…

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [December 28, 2020, 8:56pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/9 "2020-12-28T20:56:03Z")

</div>

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:

```javascript
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);}
}

```

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [December 28, 2020, 9:04pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/10 "2020-12-28T21:04:03Z")

</div>

(I fixed an err)

---

<div class="post-metadata">

**Author:** ![mathgalago](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mathgalago/32/23932_2.png) [@mathgalago](https://forum.wixstudio.com/u/mathgalago)\
**Post date:** [December 31, 2020, 6:07am UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/11 "2020-12-31T06:07:27Z")

</div>

@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)

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [December 31, 2020, 3:12pm UTC](https://forum.wixstudio.com/t/why-is-my-website-super-slow-to-load/25109/12 "2020-12-31T15:12:43Z")

</div>

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…
