diff --git a/src/engines/Cesium/hooks.ts b/src/engines/Cesium/hooks.ts index a33c716..129f7f8 100644 --- a/src/engines/Cesium/hooks.ts +++ b/src/engines/Cesium/hooks.ts @@ -571,6 +571,12 @@ export default ({ const viewer = cesium.current?.cesiumElement; if (!viewer || viewer.isDestroyed()) return; + if (!target || typeof target === "undefined" || !("id" in target && target.id)) { + viewer.selectedEntity = undefined; + onLayerSelect?.(); + return; + } + const entity = findEntity(viewer, undefined, selectedLayerId?.featureId) || findEntity(viewer, selectedLayerId?.layerId);