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 {
|
} else {
|
||||||
// Node was updated/renamed normally
|
// Node was updated/renamed normally
|
||||||
try {
|
try {
|
||||||
|
const graphValue = name === 'entity_id' ? finalValue : value
|
||||||
await useGraphStore
|
await useGraphStore
|
||||||
.getState()
|
.getState()
|
||||||
.updateNodeAndSelect(nodeId, entityId, name, finalValue)
|
.updateNodeAndSelect(nodeId, entityId, name, graphValue)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error updating node in graph:', error)
|
console.error('Error updating node in graph:', error)
|
||||||
throw new Error('Failed to update node in graph')
|
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)
|
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')) {
|
if ((nodeId === entityId) && (propertyName === 'entity_id')) {
|
||||||
// Create new node with updated ID but same attributes
|
// Create new node with updated ID but same attributes
|
||||||
sigmaGraph.addNode(newValue, { ...nodeAttributes, label: newValue })
|
sigmaGraph.addNode(newValue, { ...nodeAttributes, label: newValue })
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue