I have visibility watches on a layerList, but I cannot get the watches to hit on the items in the layerList when an item is selected. I want to get the visible item index when the item is chosen in item.layer.layers.items.


I can output the items in a forEach inside the listItemCreatedFunction, but I need to use a watch.
layerListExpand = new Expand({
content: (layerList = new LayerList({
view: view,
listItemCreatedFunction: (event) => {
let item = event.item;
let key = item.title.toUpperCase().replace(/ /g, '');
if (item.layer.type === 'group' || item.layer.type === 'tile') {
if (key === 'AERIALS') {
item.layer.layers.items?.forEach((item) => {
console.log(item.title, item.visible);
});
reactiveUtils.when doesn't get hit for item.layer.layers.item
reactiveUtils.when(
() => item.layer.layers.items, // I was selected and visible,
(visible) => {
// do something here
if (visible) console.log('visible');
}
);