OnReady code works on desktop but not mobile

Hi, I am running code that should be quite simple but not working on mobile for some reason.

Depending on a field in the dataset, element text should change/hide/show etc.

This is the code:

//This is inside the OnReady function
$w("#vendorDataset").onReady(()=> {
  if(currentItem.vendorType === "Entity")
  {
    $w('#text159').text = "Products & Services";
    $w('#text160').text = "OUR STORY";
    $w('#text158').text = "SUPPORT US";
    $w('#text8').collapse();  //hiding skills text boxes
    $w('#text9').collapse();
    $w('#text8').hide();  
    $w('#text9').hide();
    $w('#text161').expand();
    $w('#text162').expand();
    $w('#text161').show();  
    $w('#text162').show();
  }
  })

Originally I did not have the $w(“#vendorDataset”).onReady(()=> {}
function, and even then, it worked on desktop but not on mobile.

It works perfectly on desktop. The hiding/showing/changing not at all on mobile.

Can someone help out?
Thank you

The problem is probably not in the part of code you posted.
Check the console and see if it logs an error.

P.S. Maybe one of the elements you’re trying to text/collapse/show/hide doesn’t exist in your mobile view.

This is very odd, but it suddenly works, and I haven’t done anything to it. It’s happened to me before. Is there a glitch perhaps sometimes with backend data on mobile?