After some consoling and trying back and forth, the problem seems to lie here.
The allItems show up in console as they should. But the “availableItems” are the same items as allItems after clikcing the lockButton. So the allItems.filter doesnt work.
Any idea why?
// Query the Questions collection to get all items
let results = await wixData.query("Questions")
.find();
let allItems = results.items;
console.log(allItems)
// Use the array.filter method to remove the items in lockedItems from allItems
let availableItems = allItems.filter(item => !lockedItems.includes(item));
console.log(availableItems)
// Shuffle the available items
let shuffled = shuffleArray(availableItems);
console.log(shuffled)