diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts b/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts index 0fa171077..d6f10938a 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts +++ b/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts @@ -897,7 +897,9 @@ export function useUiEditorSession( setStatus('无法删除该节点。'); return result; } - if (deletedNodeIds?.has(selectedNodeId ?? '')) setSelectedNodeId(null); + if (selectedNodeId != null && deletedNodeIds?.has(selectedNodeId)) { + setSelectedNodeId(null); + } return result; }, [activeImageId, editorDeleteNode, editorUiTrees, selectedNodeId],