Repeater filter working in preview but not the live site

I’m doing some work on my portfolio site and seem to have hit a problem. I have a dynamic page displaying my work and when clicking on the button to view it, it brings up a lightbox with my work in it. This was working fine and still is.

Now, as I add more work I am obviously going to want to add a filter to this. I have added selection tags to filter the repeater which was working fine. But I wanted to set it so that only one could be selected.

I looked through the forum and found some code I could use and have since added it. This code is working and filtering the repeater correctly in the preview, but when I go to the live site, the selection tags are filtering but appear to show the previous filter as well.

If anyone could help, it would be greatly appreciated :facepunch:

Code for reference:

import wixData from 'wix-data';
import wixWindow from 'wix-window';

$w.onReady(() => {


const selectedTag =$w('#tagID').value;
let filter = wixData.filter();

if(selectedTag.length >0){              
filter = filter.hasSome("projectTypeFilter", selectedTag);

 $w("#workDataset").onReady(() => {

  $w("#work").forEachItem(($item, itemData, index) => {
   $item('#viewButton').onClick(() => {
    wixWindow.openLightbox('Work', itemData)
let tagValue = "";

export function tagID_change(event) {
 let values =;
 for (var i = 0; i < values.length; i++) {
      if (values[i] === tagValue){
   $w("#tagID").value = values;
   tagValue = values[0];