refactoring: graph state
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { useCallback, useRef, useState } from 'react'
|
||||
import type { AppNode, AppEdge } from '@/lib/graph/nodeTypes'
|
||||
|
||||
/**
|
||||
* In-memory graph state. History is a past/future stack of GraphState snapshots.
|
||||
* setNodes/setEdges push current state to past; setNodesSilent/setEdgesSilent update without history.
|
||||
* setStateImmediate replaces state and clears history (e.g. load example, import).
|
||||
*/
|
||||
export type GraphState = { nodes: AppNode[]; edges: AppEdge[] }
|
||||
|
||||
function cloneState(state: GraphState): GraphState {
|
||||
|
||||
Reference in New Issue
Block a user