No deep watch. Use selectedObjectIds

This commit is contained in:
andrewwallacespeckle
2025-08-19 10:19:48 +01:00
parent 3154258526
commit acfbc92f80
@@ -175,20 +175,18 @@ export function useViewerContextMenu(params: {
// Close context menu when selection changes
watch(
() => filters.selectedObjects.value,
(newSelection, oldSelection) => {
if (contextMenuState.value.isVisible && newSelection !== oldSelection) {
() => filters.selectedObjectIds.value,
(newSelectionIds) => {
if (contextMenuState.value.isVisible) {
const currentMenuObjectId = contextMenuState.value.selectedObjectId
const isCurrentObjectStillSelected = newSelection.some(
(obj) => obj.id === currentMenuObjectId
const isCurrentObjectStillSelected = newSelectionIds.has(
currentMenuObjectId || ''
)
if (!isCurrentObjectStillSelected) {
closeContextMenu()
}
}
},
{ deep: true }
}
)
return {