chore: cleanup broken tests, add extra documentation, make sure everything is clean and code style isn't inconsistant

This commit is contained in:
Björn Otgaar
2025-11-19 10:13:08 +01:00
parent 8c2e51114e
commit f37df1c726
12 changed files with 56 additions and 74 deletions

View File

@@ -47,6 +47,12 @@ const initialEdges: Edge[] = [
{ id: 'phase-1-end', source: 'phase-1', target: 'end' },
];
/**
* How we have defined the functions for our FlowState.
* We have the normal functionality of a default FlowState with some exceptions to account for extra functionality.
* The biggest changes are in onConnect and onDelete, which we have given extra functionality based on the nodes defined functions.
*/
const useFlowStore = create<FlowState>((set, get) => ({
nodes: initialNodes,
edges: initialEdges,
@@ -56,7 +62,6 @@ const useFlowStore = create<FlowState>((set, get) => ({
set({nodes: applyNodeChanges(changes, get().nodes)}),
onEdgesChange: (changes) => set({ edges: applyEdgeChanges(changes, get().edges) }),
// Let's make sure we tell the nodes when they're connected, and how it matters.
onConnect: (connection) => {
const edges = addEdge(connection, get().edges);
const nodes = get().nodes;