Remember the users filter selection

I really like you, Yisrael
I don’t know how to thank you. You helped me a lot
Great example
I have 6 drop-down menus for filter operation, how can I add them to the previous example

import wixData from 'wix-data';
import {local} from 'wix-storage';
import {session} from 'wix-storage';

const PREV_TITLE = 'PREV_TITLE';
const PREV_add = 'PREV_add';

let lastFilterTitle;
let lastFilteradd;

$w.onReady(() => {
  loadsooq();
});

let debounceTimer;
export function iTitle_keyPress(event, $w) {
 if (debounceTimer) {
    clearTimeout(debounceTimer);
    debounceTimer = undefined; //what is this line for?
  }
  debounceTimer = setTimeout(() => {
    filter($w('#iTitle').value, lastFilteradd);
  }, 500);
}

export function dropdown3_change(event, $w) {
  filter(lastFilterTitle, $w('#dropdown3').value);
}

function filter(title, add) {
 if (lastFilterTitle !== title || lastFilteradd !== add) {
 let newFilter = wixData.filter();
 if (title)
      newFilter = newFilter.contains('add', title);
 if (add)
      newFilter = newFilter.contains('add', add);
    $w('#dynamicDataset').setFilter(newFilter);
    lastFilterTitle = title;
    lastFilteradd = add;
  }
 //save for next session (and if it's empty, remove any old leftovers)
 if (title)
    local.setItem(PREV_TITLE, title);
 else
    local.removeItem(PREV_TITLE);
 if (add)
    local.setItem(PREV_add, add);
 else
    local.removeItem(PREV_add);
}

function loadsooq() {
/*  wixData.query('sooq')
    .find()
    .then(res => {
      let options = [{
        "value": '',
        "label": 'All sooq'
      }];
      options.push(...res.items.map(add => {
        return {
          "value":add .add,
          "label": add.add
        };
      }));*/
 //$w('#dropdown3').options = options;
      loadPrevSearch();
 
}

function loadPrevSearch() {
 let prevTitle = local.getItem(PREV_TITLE);
 let prevadd = local.getItem(PREV_add);
 if (prevTitle) {
    $w('#iTitle').value = prevTitle;
  }
 debugger;
 if (prevadd) {
    $w('#dropdown3').value = prevadd;
  }
 if (prevTitle || prevadd) {
    filter(prevTitle, prevadd);
  }
}

I canceled the dropdown value because the duplicate value appears duplicate in the dropdown list. I don’t know if there is a way not to repeat it
Thank you so much

@alkanani98 For each dropdown, you will need to add another filter to the database query . See the code snippets in the documentation for examples how to add different types of filters and conditions.

To eliminate duplicates in a dropdown, see Example: Remove duplicates from connected dropdown options using distinct() query .

Awesome :ok_hand: