Repeater loads and then disappears

I have a repeater set up on multiple pages and it has been working well for quite some time, but it seems to have broken recently. Here is an example:
https://www.igniteutah.org/meet-the-board

When loading the page, sometimes it loads just fine. Other times, the repeater doesn’t seem to load at all. Other times, the repeater loads and then disappears. This used to work great, and we didn’t change anything. How do I fix this?

Any updates on this ? I have exactly the same issue @yisrael-wix @ohad-laufer and I almost reached my “GoLive” but I can’t publish it with this bug.

Please see screenshots.

The buggy repeater on page influced.com/manage-applications

You need to be logged in as corp2@corp.net The results of the repeater are user specific. Nevertheless, sometimes when I click on that page the repeater loads fine. In other cases nothing appears or the first 3 entries appear but some of the content (especially) images are not updated.

In this case, if you click on the “show more applications” button you might the see other correctly rendered items, whereas the first 3 stay corrupted.

See the screenshots please :slight_smile:

  1. Error - Sometimes the first 3 items dont render correctly, but the remaining do
    – Screenshot removed to keep the site secret till its published. Sorry for that –

  2. Error - Something (after Login, or coming from another page) nothing can be seen
    – Screenshot removed to keep the site secret till its published. Sorry for that –

  3. Correct - This is how it is supposed to be and how it looks like [sometimes :wink: ]
    – Screenshot removed to keep the site secret till its published. Sorry for that –

can’t access your site.
please provide login credentials or paste here any console errors you get

@oezdemirumut I have looked at the code on the web page in question. You have several things going on that I would recommend you fix. I have annotated the code snippet below. This may not be all of your problems but they will likely contribute to the issues you are facing.

I would recommend that you re-familiarize yourself with the wix-Data, Dataset and repeater scope models and what JavaScript event handlers do and consider refactoring your code to make bug detection easier!

Cheers
Steve

//-----------------------------#1 YOU HAVE TOO MANY $w.onReady() CALLS --------------//
//   This may work but will not necessarily result in the behavior you are expecting //
//   You should put all of your start up code in ONE SINGLE $w.onReady() function .  //

$w.onReady(() => {
  if($w("#repeater1").rendered === false){
    winLocation.to(winLocation.url)
  }
})
//                         ^          
//  ----------- MERGE THIS | AND THAT | INTO A SINGLE onReady() WITH THE OTHER ONES //
//                                    v
$w.onReady(()=> {
	
  // all details to the campaign is "allCampaignDetails"
  wixData.query("campaignCollection")
  .contains("_owner", user.id)
  .find()
  //
  .then((result) => {
//---------------- #2 YOU SHOULD CONSIDER USING DIFFERENT NAMES FOR result -----------//
// This is for clarity as much as anything else. You may have scope issues. The comment//
//     'all details to the application and applied influencers is "result"'           //
// Implies you want to use result for a particular purpose BUT you have two places    //
// 'result' is set one is the .then() above & the other is in the getItems().then() //
// below. Make sure you are using this variable correctly! I would use unique names   //                         

		allCampaignDetails = result.items
    //console.log(allCampaignDetails)
    result.items.forEach(element => {
      campaignIDtechnical.push(element.campaignIDtechnical)
    })
  }).then( () =>{
//
//-------- #3 YOU ARE NOT WAITING FOR $w('#dataset1').onReady() BEFORE YOU getItems ---//
// When this is called the dataset may not be loaded. So the initial call to getTotalCount() may      //
// return 0. So nothing will be returned. You should wrap the getItems code below in an onReady //
//
    // all details to the application and applied influencers is "result"
		$w("#dataset1").getItems(0, $w("#dataset1").getTotalCount())

		.then((result) => { // <<<<<< THIS IS THE SECOND PLACE WHERE YOU SET RESULT
      allApplicationDetails = result.items

//---------------- #4 YOU ARE MAKING AN ASSUMPTION ABOUT the 'result' variable here ---//
// Just because you asked for .getTotalCount() items from $w('#dataset1') doesn't                 //
// mean you were returned that number. This for loop should be i < result.length!!                   //
// . As mentioned above if the dataset finishes loading after you called getItems then it is .      //
// possible that result.length = 0 BUT $w("#dataset1").getTotalCount() is > zero and this will .  //
// fail.

			for (let i= 0 ; i < $w("#dataset1").getTotalCount() ; i++) {

				let temp_img;
        let campaign_ID;
        let status;
        let influencer_name;
        let influced_name;
        let motivation;
        let language;
        let followers;
        let age;
        let gender;
        let personal_image;
        let address;
        let addressline2;
        let zipCode;
        let city;
        let country;
        let state


				if (campaignIDtechnical.indexOf(result.items[i].idCampaignTechnical) > -1 && result.items[i].status === "not answered") {
					//console.log("yes sir, i contain, ", result.items[i].idCampaignTechnical)
          allCampaignDetails.forEach(element => {
            if(element.campaignIDtechnical === result.items[i].idCampaignTechnical) {

              temp_img = element.campaignImages1
              campaign_ID = element.campaignID

            }
          })

          repeater_data.push(
			  {"_id":(row_i+1).toString(10),
			  "img":temp_img,
			  "campaignID":campaign_ID,
			  "status":result.items[i].status,
			  "influencerName":result.items[i].influencerName,
			  "influcedName":result.items[i].influcedName,
			  "motivationText":result.items[i].motivationText,
			  "influencerLanguage":result.items[i].influencerLanguage,
			  "amountFollowers":result.items[i].amountFollowers,
			  "age":parseInt(result.items[i].age,10),
			  "gender":result.items[i].gender,
			  "personalId":result.items[i].personalId,
			  "statistics":"https://www.influced.com/influencer-statistics?influencerName="+result.items[i].influencerName,
        "address": result.items[i].address,
        "addressline2": result.items[i].addressLine2,
        "zipCode": result.items[i].zipCode,
        "city": result.items[i].city,
        "country": result.items[i].country,
        "row_idx": i
			  })

			  row_i++
				}
			}
		}).then(()=> {
      $w("#repeater1").data = repeater_data.slice(fromPagination, toPagination);
        if(repeater_data.length > toPagination) {
          $w("#showMore").expand() 
        }
        $w("#totalApplications").value = parseInt(repeater_data.length, 10)

				$w("#repeater1").onItemReady( ($item, itemData, index) => {
        $item("#rowIDX").value = itemData.row_idx;
				$item("#img").src = itemData.img;
				$item("#campaignID").text = itemData.campaignID;
				$item("#status").text = itemData.status;
				$item("#row").text = (itemData._id).toString(10);
				$item("#influencerName").text = itemData.influencerName;
				$item("#influcedName").text = itemData.influcedName;
				$item("#motivationText").value = itemData.motivationText;
				$item("#influencerLanguage").text = itemData.influencerLanguage;
				$item("#amountFollowers").value = parseInt(itemData.amountFollowers,10)
				$item("#age").text = (itemData.age).toString(10);
				$item("#gender").text = itemData.gender;
        $item("#statistics").target = "_blank"
				$item("#statistics").link = itemData.statistics;

        if (itemData.personalId === null || itemData.personalId === undefined){
          $item("#idCard").collapse()
          $item("#personalId").collapse()
        }else {
          $item("#personalId").src = itemData.personalId;
        }
        
        $item("#address").text = itemData.address;
        
        if (itemData.addressLine2 === null || itemData.addressLine2 === undefined) {
          $item("#addressline2").collapse()
        }else{
          $item("#addressline2").text = itemData.addressLine2
        }

        $item("#zipCode").text = itemData.zipCode;
        $item("#city").text = itemData.city;
        $item("#country").text = itemData.country;
        
        if (itemData.state === null || itemData.state === undefined) {
          $item("#state").collapse()
        }else
        {$item("#state").text = itemData.state}

        if (itemData.influencerImage === null || itemData.influencerImage === undefined) {
          $item("#influencerImage").collapse()
        }else{
          $item("#influencerImage").src = itemData.influencerImage
        }
      
        
        /*
				$item("#img").onClick( (event) => {
				let $item = $w.at(event.context);
				$item("#campaignID").text = "Selected";
				}); */

//----------- #5 THIS IS NOT THE RECOMMENDED WAY TO WRITE A REPEATER EVENT HANDLER ---//
// To make your code easier to read and debug you should define your event handlers   //
// Outside of the repeater and use the $w form. Again you are using $item which has   //
// scope above and redeclaring it below in the handler. This is probably giving you   //
// Errors in the Corvid editor. Try to Take all of your $item().onCLick() handlers out//
// of this repeater block and declare them as $w() e.g. $w("#acceptBtn").onClick...   //
// The $item code is correctly being set using $w.at() and is why you should do this. //
        $item("#acceptBtn").onClick( (event) => {
				let $item = $w.at(event.context);
        let updateData = allApplicationDetails[$item("#rowIDX").value]
        repeater_data.splice(row_i,1)
        delete updateData._owner
        delete updateData._createdDate
        delete updateData._updatedDate
        updateData.status = "accepted"
        //console.log($item("#rowIDX").value)
        //console.log(allApplicationDetails[$item("#rowIDX").value])
				wixData.update("applicationCollection", updateData)
        .then(() => {
          $item("#acceptedBox").show("fade",{"duration":300})
				});
        })
        

        $item("#rejectBtn").onClick( (event) => {
				let $item = $w.at(event.context);
        let updateData = allApplicationDetails[$item("#rowIDX").value]
        repeater_data.splice(row_i,1)
        delete updateData._owner
        delete updateData._createdDate
        delete updateData._updatedDate
        updateData.status = "rejected"
        //console.log($item("#rowIDX").value)
        //console.log(allApplicationDetails[$item("#rowIDX").value])
				wixData.update("applicationCollection", updateData)
        .then(() => {$item("#rejectedBox").show("fade",{"duration":300})})
				});

       /* $w("#statistics").onClick( (event) => {
          let $item = $w.at(event.context);
					winLocation.to($item("#statistics").text)
				}); */

        $w("#idCard").onClick( (event) => {
            let $item = $w.at(event.context);
            if($item("#personalId").collapsed === true) {
              $item("#personalId").expand();
            }else {
              $item("#personalId").collapse();
            }
        }); 
			});
    })
	})
  $w("#repeater1").show()
}); 

@stevesoftwareservice Thank you Steven, I will work on your suggestions and let you know my results! In the meanwhile I have created a testuser:

Hello @ohad-laufer ,
I will try the suggesitions of Steven.
Further, I added a new testuser:

Hello @stevesoftwareservice ,

first, thank you so much for your help. I (think), I fixed it. Let me comment the above mentioned hints:

#1: I applied that and I will consider that in every single page from now
#2: I did that for the purpose of readability and debugging. In my opinion It shouldn’t had effect logic, since both “result” were in different then() scopes.
#3: Thats really important!
#4: Thats also really important!
#5: Actually the officials docs show it like this

So, what fixed it finally? To be honest I can’t tell. I just recoded the logic from scratch and followed Stevens suggestions. For every other reader, if you have a similiar issue, try to compare the above code with yours and see Stevens comments on that.

BUT

For testing i had refreshed the website about 20 times in a row and everything worked out. 2 hours later, when I refreshed I had seen similar issues, although I did not change any part of the code which could have effected that. I was working on design aspects. Once again, I refreshed and I had seen a 502 bad gateway error. From then on with every refresh the issue occurred again or 502 happened. And now, just further 2 hours everything works out again, no issue after 15 refreshs in a row, so far. So I am really assuming that the repeater behavior is also related to maintenance hours of Wix?

PLEASE
@alexander-wix @sapirh @yisrael-wix @corvidcode

Could you please publish maintenance hours of Wix, especially Corvid?:

  1. Developers: Like in my case developers can expect “weird” issues of the site instead getting desperate for hours.

  2. Users/Customers: We can communicate it to our users/customers. So they have a chance to know, that some services might won’t work as expected.

@oezdemirumut Hi Umut: Glad you figured this out. Sometimes a simple refactoring can save the day (even if you don’t know why ;-).

Having a simple way to know when there is a service interruption or failing A B test would help immensely with testing Corvid apps.

Many if us have spent too much time trying to debug something only to find out that the backend was the problem and not our code.

Great suggestion.

Hi Corvid Team,

I am experiencing similar issues to Jay, where my repeaters sometimes load the content fine and sometimes don’t. Most of the time they seem to be displaying the placeholder content which i set in the editor for visual design reference - they are connected through data binding.

I have attached a GIF below, where you will be able to watch and see me refresh the site TWICE and it happens this time on both occasions.

Does this happen on Windows and Mac systems? - Yes

Does this happen on more than one type browser? - Yes

What page doest this happen on the most? - New Wix Blog > Single Post Page

Example URL to test? - Click Here

@ohad-laufer + @yisrael-wix + @alexander-wix

Did you make sure to use $w(‘#myDataset‘).onReady() ?

What site page is this happening on? Is it this one?


There is no repeater on this page. I see the component #post1 which is for Wix Blog. You also have no code on this page.

This forum is dedicated to Corvid. For questions that are not related to code you can contact the Wix support team . You’ll get better help for your problem there.

@yisrael-wix - seriously? This is not related to code? Are you having a joke? Of course this issue is related to Corvid.

The page this is happening on is indeed the blog post page and there is a repeater on the page, if you look carefully?..

I would like to also elaborate that the Support team do not have a clue when it comes to Corvid components, in my experience anyway. Every time they just direct us to this forum when it comes to issues like this.

Stop trying to ignore the issue.

@contact53319 I looked very carefully and didn’t see any code:

@yisrael-wix of course there is no code, my point above clearly states that the repeater is:

  1. Connected using Data Binding settings panel
  2. The repeater on most occasions resets itself after loading as per the explanation in the video GIF above.

Data Binding & Repeaters are part of the Corvid product, at no point did i say they were connected through Code. I am trying to help you guys, don’t try and pam me off to the support team - who have no idea and will give me all the saved replies on how to clear cache, cookies, etc. It’s always the same from them. Standard replies.

On this forum we can at least get close to the teams who develop the product. No? Come on. Help me.

@contact53319 Data binding and Repeaters are not part of the Corvid product. Data bindings belong to WixData , and Repeaters are part of the general Wix site product.

I’ve referred this issue to QA for their evaluation.

Hi [@Yisrael (Wix)] -

Thank you so much for this, the issue is, people pay to be on this so if it’s just resetting then it’s no use…:frowning:

@contact53319 I understand. I’m a code guy, which means Corvid. Without code there’s not much I can do. If there’s a problem, the QA team will be able to identify it and then open a ticket for the appropriate development team to take care of it.

I’m a code guy too :joy: but this has just made me panic that’s all lol

@contact53319 Hi. I’ve checked the issue and it seems to be a bug. I’ve notified our development team about it. Sorry for the inconvenience and thank you for letting us know.

Hi [@Aleksander Denga] - thank you for confirming this, I look forward to a prompt fix as this is not acceptable.