Filterable Gallery by Dropdown

Hi all!

I’m trying to create a gallery that is filterable by a dropdown menu with no success. I read every possible thread and tutorial. This is where I’m standing:

This is the gallery and dropdown:

I managed to get the dropdown and the gallery to show the corresponding database items:

But when I choose an option from the dropdown, nothing shows in the gallery and the dropdown stops working:

Here’s the code I’m using for onChange on the dropdown menu:

import wixData from “wix-data”;

$w.onReady(() => {

let lastFilterCategory;

export function iCategory_change(event, $w) {

function filter(category) {
if (lastFilterCategory !== category) {
let newFilter = wixData.filter();

if (category)
newFilter = newFilter.contains(‘category’, category);
lastFilterCategory = category;

function loadCategories() {
.then(res => {
let options = [{“value”: ‘’, “label”: ‘כל הקטגוריות’}];
options.push(… => {
return {“value”: continent.title, “label”: continent.title};
$w(‘#iCategory’).options = options;


Any idea what’s wrong?
Bonus question: how do I get rid of duplicates in the dropdown menu?

Thanks a lot,