Some one please help I have been trying for days to get this code working correctly, it works perfectly in preview but not on published site

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

export function gallery1_currentItemChanged(event) {
$w.onReady( () => {
$w("#dataset1").onReady( () => {
if ($w("#dataset1").getCurrentItem().vid===("Video")){
  console.log("Video");
  $w('#ClipBtn').expand();  
    } else {
    console.log("No Video");
    $w('#ClipBtn').collapse();  
    }
});
});
}
if ($w("#dataset1").getCurrentItem().vid === "Video"){

Thanks for you response the main problem is that it takes two event changes f " gallery1_currentItemChanged ( event )" for the if else to work. But it only happens on live site

@iandawson51
If something works in SANDBOX but not in LIVE site,

these are in most cases the errors…

  1. Not synced DATABASE between SANDBOX and LIVE.
  2. No given PERMISSONS in DATABASE.
  3. READ & WRITE -OPTIONS on DATASETs.

@russian-dima Thanks for the info have made sure live and sandbox are synced
permissions are set to anyone and dataset is set to read only. The address is www.lotsofdoodles.com. Would appreciate any further help

Hi, what exactly is not working on the published site?

It takes two event changes of the gallery before the video icon appears or disappears.

@iandawson51 Submit this to the thread " Rolling out improvements to Corvid sites rendering"