I've spent far too much time today trying to figure this out. In the 4.X API, how do you unselect a selected graphic? My specific issue is with a popup on a graphicsLayer where the graphic is not unselected when the popup is closed. FWIW, this would be my relevant code:
// Search for graphics at the clicked location
theView.hitTest(screenPoint,{include:theGLayer}).then(function (response) {
if (response.results.length) {
var theContent = app.plmf.graphicsLayerContent(response.results[0].graphic);
var theTitle = "User Defined Project";
theView.openPopup({title:theTitle, content:theContent, location: event.mapPoint});
//}
}
});
});
//Unselect the interactive project when the popup is closed
reactiveUtils.watch(
// getValue function
() => theView.popup.visible,
// callback
(visible) => {
if (visible == true) {
//Do Nothing
} else {
console.log('The popup is closed');
theView.popup.clear();
}
});