Collapse not working in live

See below. The two .collapse() functions below work in preview but not live.

//-------------Imports-------------//

import wixData from ‘wix-data’ ;
import wixUsers from ‘wix-users’ ;
import wixLocation from ‘wix-location’ ;
import wixWindow from ‘wix-window’ ;

//-------------Variables-------------//

// Get the user ID which was created for the new member
let userId;
let user;

$w.onReady( function () {

//Don’t show these section initially.
$w( “#moreInfo” ).collapse();
$w( “#moreInfo2” ).collapse();

// Run the main function to update the page.
$w( “#dynamicDataset” ).onReady(() => {

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

        user = wixUsers.currentUser; 
        userId = user.id; 

        updatePage(); 

    }); 
}); 

});