refactor(store): check if state variables have to be re-set

* instead of just pasting over the state constantly check what needs to be re-set

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-25 15:21:36 +01:00
parent 74cc61ad8d
commit 96d54c59dc
5 changed files with 150 additions and 81 deletions
+5
View File
@@ -9,6 +9,11 @@ export type FlowElement<T = any> = GraphNode<T> | GraphEdge<T>
export type FlowElements<T = any> = FlowElement<T>[]
export type Elements<T = any> = (Node<T> | Edge<T>)[]
export type NextElements = {
nodes: GraphNode[]
edges: GraphEdge[]
}
export type Transform = [number, number, number]
export enum Position {
+2 -1
View File
@@ -73,7 +73,7 @@ export interface FlowState extends Omit<FlowOptions, 'elements'> {
}
export interface FlowActions {
setElements: (elements: Elements) => void
setElements: (elements: Elements) => Promise<void>
setUserSelection: (mousePos: XYPosition) => void
updateUserSelection: (mousePos: XYPosition) => void
unsetUserSelection: () => void
@@ -89,6 +89,7 @@ export interface FlowActions {
setConnectionNodeId: (payload: SetConnectionId) => void
setInteractive: (isInteractive: boolean) => void
addElements: (elements: Elements) => void
setState: (state: FlowOptions) => Promise<void>
}
export interface FlowGetters {