Allow me to show another way of doing this, assuming that your dropdowns are manually connected instead of coded.
//Function that filters repeated items from dropdowns
const filter = (list, listToFilter) => {
return listToFilter.filter(({ label }) => !list.some(item => item.label === label))
}
$w.onReady(async () => {
//Wait for the dataset A to be ready
$w('#datasetA').onReady(() => {
//Wait for the dataset B to be ready
$w('#datasetB').onReady(() => {
//Get the dropdown values
const dd1 = $w('#dropdown1').options
const dd2 = $w('#dropdown2').options
//Filter the values
const filteredDD = filter(dd1, dd2)
//Feed them to the dropdown that needs filter
$w('#dropdown2').options = filteredDD
})
})
})
Best regards.