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:
parent
c36afecba4
commit
79a17c3f7f
2 changed files with 3 additions and 2 deletions
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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 })
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue