Fix graph value handling for entity_id updates

• Use finalValue for entity_id changes
• Keep original value for other props
• Fix property update logic
This commit is contained in:
yangdx 2025-10-30 23:43:46 +08:00
parent c36afecba4
commit 79a17c3f7f
2 changed files with 3 additions and 2 deletions

View file

@ -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')

View file

@ -246,7 +246,7 @@ const useGraphStoreBase = create<GraphState>()((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 })