TypeError: Cannot read property 'items' of undefined

Hi, I use the code above to filter a repeater… it worked before but know the owner of the site said it’s doesn’t work anymore… I’ve checked it I get this Error: TypeError: Cannot read property ‘items’ of undefined… I don’t see what’s wrong, can someone help me with this?

import wixData from 'wix-data';

export function sorteazap_click(event, $w) {

 if ($w('#zona').value === "Any") {
      $w("#dataset5").setFilter(wixData.filter()
     .contains("inchiriereVanzare", $w('#tipvanzare').value)
     .contains("tip", $w('#tippropietate').value))

.then((results) => 
      {
         console.log("Dataset is now Filtered");
          $w("#repeater1").data = results.items;
     })
  .catch((err) => {
   console.log(err);
  });      

 $w("#repeater1").expand();
   }
 else {
 $w("#dataset5").setFilter(wixData.filter()
     .contains("inchiriereVanzare", $w('#tipvanzare').value)
     .contains("zona", $w('#zona').value)
     .contains("tip", $w('#tippropietate').value))

.then((results) => 
      {
         console.log("Dataset is now Filtered");
          $w("#repeater1").data = results.items;
     })
  .catch((err) => {
   console.log(err);
  });      

 $w("#repeater1").expand();
   }

}

Hello Alex,

without taking a closer look at your code, question!

Did something changed on the CODE?

If not than something changed on the site or in database.
For example the type of values (from NUMBER to STRING or vice versa).
So perhaps the Site-Owner changed something in his database.

I would ask the site-owner, what was changed the last time, when the error came.

You have also the possibility to use Wix-editors “HISTORY-OPTION” to go back in history…

nothing has changed