From 79a17c3f7f7377cf767d08ee4f778649a756d578 Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 30 Oct 2025 23:43:46 +0800 Subject: [PATCH] Fix graph value handling for entity_id updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Use finalValue for entity_id changes • Keep original value for other props • Fix property update logic --- lightrag_webui/src/components/graph/EditablePropertyRow.tsx | 3 ++- lightrag_webui/src/stores/graph.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lightrag_webui/src/components/graph/EditablePropertyRow.tsx b/lightrag_webui/src/components/graph/EditablePropertyRow.tsx index 5a1297d3..1604bcdc 100644 --- a/lightrag_webui/src/components/graph/EditablePropertyRow.tsx +++ b/lightrag_webui/src/components/graph/EditablePropertyRow.tsx @@ -126,9 +126,10 @@ const EditablePropertyRow = ({ } else { // Node was updated/renamed normally try { + const graphValue = name === 'entity_id' ? finalValue : value await useGraphStore .getState() - .updateNodeAndSelect(nodeId, entityId, name, finalValue) + .updateNodeAndSelect(nodeId, entityId, name, graphValue) } catch (error) { console.error('Error updating node in graph:', error) throw new Error('Failed to update node in graph') diff --git a/lightrag_webui/src/stores/graph.ts b/lightrag_webui/src/stores/graph.ts index 36c1d7b5..f2e89981 100644 --- a/lightrag_webui/src/stores/graph.ts +++ b/lightrag_webui/src/stores/graph.ts @@ -246,7 +246,7 @@ const useGraphStoreBase = create()((set, get) => ({ console.log('updateNodeAndSelect', nodeId, entityId, propertyName, newValue) - // For entity_id changes (node renaming) with NetworkX graph storage + // For entity_id changes (node renaming) with raw graph storage if ((nodeId === entityId) && (propertyName === 'entity_id')) { // Create new node with updated ID but same attributes sigmaGraph.addNode(newValue, { ...nodeAttributes, label: newValue })