help! hiding a section if the reference fields is empty

Did you ever checked which results you get ???

$w.onReady(function () {
   $w("#dynamicDataset").onReady( () => { 
       let item = $w("#dynamicDataset").getCurrentItem();
       console.log("ITEM: ", item);
   });
});

Take a look into your console and ispect the results.