URGENT: Repeater displaying items from a dataset suddenly bugging out and displaying an item many times when filtered ?

Hello! On my webpage I have a repeater that is connected to a dataset which displays different items from a database (job postings). I also have a filter system (drop down menus and radio button options) so that people can filter out the contents in the repeater based on different parameters (job listing type, location, experience level, office type).

Up until today, everything seemed to be working fine. The code associated to the filter options was working great the filter options would successfully filter out the repeater items based on what was selected in the drop down menus. However, all of a sudden today, when selecting filtering options and clicking “Search”, the repeater displays only 2 or 3 correct listings, and the rest of the items are duplicates/copies of the first item in the database. For example, if there are 3 items in the database with the value “internship”, it displays 3 items in the repeater once filtered, though only the first one loads properly and the remaining 2 are carbon copies of whatever is in the first row in the database. NOTE: This happens only when using some filter options (even in the same dropdown menu, some work and some bug out in this way), though did not occur before and no changes were made to the code

This is super weird as it did not happen before, and no modification to the code were done. I’ve also noticed that even if I remove the first item in the database, this issue happens again and the duplicated items in the repeater are once again whatever is now the first row of the database.
I’ve double checked that database entries are correctly labelled and there’s no errors in the fields. IMPORTANT NOTE: I think this MIGHT be a database problem since reverting changes/history to when it worked for sure does NOT fix this - it still displays copies of the repeater items when filtered. I update the database with new job listings every Wednesday, and don’t usually touch the code during this.

Here’s a picture of my database columns and the first row (hopefully readable)

This issue is simply beyond me and has drained me of my energy and existence to begin with. I am attaching the code below just in case. The code basically takes values from the database, populates the drop down menus, has a search and clear button function which filters and displays items in the repeater.

import wixData from 'wix-data';

//start of JobField dropdown - work please i beg of

$w.onReady(function () {

 wixData.query("jobpostings")
 .limit(1000)
 .find()
 .then(results => {

 const uniqueItems = getUniqueItems(results.items);
 $w("#countryDropdown").options = buildOptions(uniqueItems);

 const uniqueItems2 = getUniqueItemsLoc(results.items);
 $w("#companyType").options = buildOptions(uniqueItems2);

 const uniqueItems3 = getUniqueItemsType(results.items);
 $w("#employment").options = buildOptions(uniqueItems3);

 const uniqueItems4 = getUniqueItemsCompany(results.items);
 $w("#companySize").options = buildOptions(uniqueItems4);

 });
//---------------------------------------------------------//

 function getUniqueItems(items) {
 const itemsOnly = items.map(item => item.field);
 return [...new Set(itemsOnly)];

 }

 function getUniqueItemsLoc(items) {
 const itemsOnly = items.map(item => item.location);
 return [...new Set(itemsOnly)];

 }

 function getUniqueItemsType(items) {
 const itemsOnly = items.map(item => item.type);
 return [...new Set(itemsOnly)];

 }

function getUniqueItemsCompany(items) {
 const itemsOnly = items.map(item => item.companyType);
 return [...new Set(itemsOnly)];

 }

 function buildOptions(uniqueList) {
 return uniqueList.map(curr => {
 return { label: curr, value: curr };

 });

 }
 

});

// end of jobField dropdown - please work i beg of you

export function input1_keyPress(event) {
 let SearchValue = $w("#input1").value;
 $w("#dataset1").setFilter(wixData.filter().contains('jobTitle', SearchValue)
 .or (wixData.filter().contains('location', SearchValue))
 .or (wixData.filter().contains('field', SearchValue))
 .or (wixData.filter().contains('type', SearchValue))
 .or (wixData.filter().contains('organization', SearchValue)));

 
}

export function searchButton_click(event) {
 search();
}
 
function search() {
 
 wixData.query("jobpostings")
 .contains("field", String($w("#countryDropdown").value))
 .and(wixData.query("jobpostings").contains("location", String($w("#companyType").value)))
 .and(wixData.query("jobpostings").contains("type", String($w("#employment").value)))
 .and(wixData.query("jobpostings").contains("remote", String($w("#checkboxGroup1").value)))
 .and(wixData.query("jobpostings").contains("companyType", String($w("#companySize").value)))
// .and(wixData.query("jobpostings").contains("partners", String($w("#approved").value)))
 
 
 
 .find()
 .then(results => {
 $w("#repeater4").data = results.items;
 });
 
}

// =============================================//

$w.onReady(() => {

$w('#clearButton').onClick(() => {
 $w("#countryDropdown").value = undefined
 $w("#companyType").value = undefined
 $w("#employment").value = undefined
 $w("#companySize").value = undefined
 $w("#checkboxGroup1").value = undefined
 //$w("#approved").value = undefined
 $w("#dataset1").setFilter(wixData.filter()
 .eq('field', location))
 
 });
 
 });
 

I would REALLY appreciate help with this as it is urgent and currently live on my webpage. Furthermore, thank you for your time and patience.

THANK YOU!

This sounds very similar to my current experience as posted here

I am basically getting the first item from my dataset collection showing up on all result items when I have run a search (which in essence just filters results).

As you are experiencing this as well, I am wondering if this is a bug within Wix as I also made no changes to any code or layout of the pages in question? I have logged it with Wix support but I am waiting for a response currently

Do not change anything on your CODE. It sounds like Wix has done some UPDATES on their side. Just wait, till everything is working normaly again.
If after 1-2 days still nothing happened, contact wix-support / customer-care.

There were several posts with different issues in the past 1-2-days.

So just try to be patient.

Hi Matt and Dorijan,
I’ve shared your posts with our support team. They will follow up with you. In the meantime, you can also report your issue to Wix Customer Care to expedite the process. Thanks!

Hi there :raised_hand_with_fingers_splayed:

You’re saying you’re using a dataset to populate the repeater, then why do you use wixData to populate the repeater items? Do you know that using the dataset and wixData can cause a conflict in the repeater and raise many unexpected issues? You should either use the dataset to populate the repeater or wixData, never assign items to any repeater connected to a dataset.

Also, you have 2 onReady() functions where you should only have one on the top of the code file.

I do not think it’s a bug in the repeater or the dataset components, I suspect it’s caused by the conflict caused by assigning items to the $w.repeater.data property of a repeater that is connected to the database, the proof of what I’m saying is that you said this only happens when you change the filters, which triggers your search() function and assign the results to the repeater’s data property.

@marlowe-shaeffer Please read this.
@russian-dima FYI.

Hope this helps~!
Ahmad

Hi @dlakadorijan and @mattja19 , I (and other people) are having similar issues with dataset item filtering.

My code has worked fine for over 1 year, and still works fine on 2 other websites. I just wanted to post this to give confirmation, that I also believe this is because of some update.

@ahmadnasriya hmm, will definitely look into this, though it worked perfectly until today!

Hi Marlowe, thanks for this. I was on live chat with your support team yesterday regarding my issue (which appears to be widespread) and they kindly passed my issue onto the velo team so I am currently awaiting a response from them!

I appreciate your points Ahmad but considering so many are currently experiencing the same issue when everything was working fine 24-48 hours ago, I think that would suggest the issue lies deeper within Wix than coding errors. Our coding may not be perfect but it was doing the job we required it to and then it all just stopped, not just for 1 or 2 people but for a lot if you look at the main forum page on here :slight_smile:

@mattja19 @dlakadorijan these are fundamental issues that needs to be fixed, the fact that the code was working with bad implementations does not mean it should be supported, the dev team can’t leave it to the chance, maybe the update intentially reject these bad implementations as a way to encourage users to write a healthier code.

Anyway, before the dev team can inspect your codes, try to fix the current issues in your code and see if the issues persist.

I did build a test page specifically for this purpose, and everything worked just fine.

Will definitely implement changes based on your comment, though unsure how atm! Given that my repeater is connected to the db using the wix interface and has maaany specific elements connected to it (title of job listing, type, category, location, language, etc… connected manually without code) im now wondering whats the most logical way to apply your comment and clean up my code/page. Not sure about this, do i remove that segment of code? Do i disconnect the repeater to the db from the interface? Wouldnt I then have to connect the individual elements of each item by code? Still a big newbie here, learning by the day, would appreciate further feedback! Btw, thank you for the feedback already. Means a lot!

@Velo-Ninja FYI. <---- ? Ahmad whats that? Something gone wrong?

@dlakadorijan I suggested to:

  1. use either the dataset or wix-data, but not both.

  2. Use one onReady function per page and per dataset.

  3. You must wait for a component to be ready before you interact with it or perform any action on it, that means your code needs to be inside the page’s onReady() function, and before interacting with the dataset, the relevant code should be inside the dataset’s onReady() function inside the page’s onReady() function.

$w.onReady(() => {    
    // Now that the page is ready, you must wait for the dataset to be ready too
    $w('#dataset').onReady(() => {
        // Now that the dataset is ready, you can perform filters or sorts
        $w('#dataset').setFilter();
        $w('#dataset').setSort();
    })
})

You can also read my article here.

@russian-dima just letting you know about the reason of this issue.

@dlakadorijan @marlowe-shaeffer @heavenswaffles0 - I am reporting back to advise that my functionality has returned and appears to be working as it was. It may help Marlowe and the Wix team if you guys could also check yours and report back with any findings :slight_smile:

@mattja19 Hi Mattja, I had to clear up my code and fixed the issue myself, but was worried for others as I knew the issue was systemic, glad to hear it’s also good on your end now.

@mattja19 @heavenswaffles0 - I am happy to report that the issue fixed itself in my case as well. Still trying to clear up my code and make it healthy tho :slight_smile: