BUG? Repeater.onItemReady() misses first item when _id is 'item1'

Hello,

I have this code

$w.onReady(function () {

    
    let $repeater =  $w('#repeater2');
 
 
   $repeater.onItemReady(($item,itemData,index) => {
        console.log('onitemready fired for ',itemData.name);
    });

    $repeater.data = 
    [
    { name : 'Apple' , price : 50 , _id : 'item1' } , 
    { name : 'Orange' , price : 30 , _id : 'item2'},
    { name : 'Bannana' , price : 22 , _id : 'item3'}
    ];

});

The wix documentation at data - Velo API Reference - Wix.com - states that onItemReady() has to be placed before Repeater.data.

“Because setting a repeater’s data property triggers the onItemReady() callback to run, make sure you call onItemReady() before you set the data property. Failing to do so will mean that your callbacks are not triggered when you set the data property.”

Firstly, it seems to work regardless of where I place it. Is this wrong?

Secondly, I noticed when the above code is tested the onItemReady() doesn’t trigger for Apple, but triggers for the other two.

UPDATE :
It has something to do the the _id of the first item. For some reason using ‘item1’ as the _id won’t trigger onItemReady() but changing it to ‘myItem1’ causes onItemReady() to fire correctly on apple.

onItemReady() triggers for all 3 items :


    let repeaterData = 
    [
    {  name : 'Apple' , price : 50 , _id : 'myItem1'  } , 
    {  name : 'Orange' , price : 30 , _id : 'item2'  },
    {  name : 'Bannana' , price : 22 , _id : 'item3' }
    ];

onItemReady() triggers for all items 2 and 3 only :

    let repeaterData = 
    [
    {  name : 'Apple' , price : 50 , _id : 'item1'  } , 
    {  name : 'Orange' , price : 30 , _id : 'item2'  },
    {  name : 'Bannana' , price : 22 , _id : 'item3' }
    ];

Interesting. I tried this myself and there is definitely something weird going on. I’m sending this on to QA for evaluation.

Thanks a lot

This issue is so persistent. onItemReady failed to show or hide an $item element intermittently. Any resolution?

I tried a bit myself and found out that the first item of a repeater is called item1
The others have something like this item-j9pleqw5

When removing the first item from the repeater (in the editor)
it does not give any problem anymore.

So for some reason overwriting data is not doing what it should if the _id already is the same.

By chaning it first and then overwriting it does seem to work for me.

so first i’l change it to a 1 item object array

$w("#repeater5").data = [{name : "",_id:"item"}]

the hen ill change it to the needed data.

 let data = [
        {name:"10", _id : "item1"},
        {name:"20", _id : "item2"},
        {name:"30", _id : "item3"},

    ];
     $w("#repeater5").data = data

It isn’t the way it should work,
However it’s a easy work around solution for now.

Kind regards,
Kristof.

Yea I thought so too… something might be clashing related to the Id… thanks for the tip, i just decided to go with different IDs aswell