How to hide button linked to dataset inside repeater only when the dataset entry linked to the button is empty

been trying for hours to sort this one out and referring to countless other forum posts. Everything seems to bring be close, but not quite there.

I basically have a dataset that contains links to a website that corresponds to a button inside a repeater. I need the button to not appear when there is no link inside the dataset for that entry. Everything i try, i either get all of the buttons to hide, or none. I’m also confused if i should be using the Field_Name (URL) or Field_Key (linkToCanLiSite) to check if it’s undefined.

I’m not sure if it matters, but there is a “container” inside of the “repeater”

If someone could help me out that would be amazing. Below is a screenshot of my dataset, and the website in the editor, with the button highlighted that i want hidden (when nothing in the dataset)

import wixData from ‘wix-data’;
$w.onReady(() => {
$w(“#repeater1”).forEachItem(($w, dataset1, index) => {
$w(“#litigationCasesDataset”).onReady(() => {
let currentItem = $w(“#litigationCasesDataset”).getCurrentItem();
let $item = $w(“#buttonLinkToCase”);
if (currentItem.linkToCanLiSite === undefined) {
$item.hide();
$item.collapse(); // set height to 0
} else {
$item.show();

}
});
});
});