refactor(store): reset on unmount

This commit is contained in:
moklick
2021-11-23 18:37:12 +01:00
parent f775cf29ca
commit 296289710f
4 changed files with 63 additions and 44 deletions
+9 -3
View File
@@ -130,7 +130,7 @@ export type InitD3ZoomPayload = {
transform: Transform;
};
export interface ReactFlowState {
export type ReactFlowStore = {
width: number;
height: number;
transform: Transform;
@@ -169,9 +169,11 @@ export interface ReactFlowState {
multiSelectionActive: boolean;
reactFlowVersion: string;
};
export type ReactFlowActions = {
setNodes: (nodes: Node[]) => void;
setEdges: (edges: Edge[], nodes: Node[]) => void;
setEdges: (edges: Edge[]) => void;
updateNodeDimensions: (updates: NodeDimensionUpdate[]) => void;
updateNodePosition: (update: NodeDiffUpdate) => void;
setUserSelection: (mousePos: XYPosition) => void;
@@ -209,7 +211,11 @@ export interface ReactFlowState {
onConnectStart?: OnConnectStart;
onConnectStop?: OnConnectStop;
onConnectEnd?: OnConnectEnd;
}
reset: () => void;
};
export type ReactFlowState = ReactFlowStore & ReactFlowActions;
export type UpdateNodeInternals = (nodeId: string) => void;