Merging dev into main #49

Merged
8464960 merged 260 commits from dev into main 2026-01-28 10:48:52 +00:00
2 changed files with 4 additions and 11 deletions
Showing only changes of commit 7b12ae1f5e - Show all commits

View File

@@ -13,11 +13,6 @@ import useFlowStore from "../VisProgStores.tsx";
import styles from "../../VisProg.module.css"
// Is used to make sure each subsequent node gets a unique id, so the ReactFlow implementation
// can distinguish between different nodes.
let id = 0;
const getId = () => `dndnode_${id++}`;
/**
* DraggableNodeProps dictates the type properties of a DraggableNode
*/
@@ -97,12 +92,7 @@ export function addNode(nodeType: string, position: XYPosition) {
};
}
default: {
return {
id: getId(),
type: nodeType,
position,
data: {label: `new default node`},
};
throw new Error(`Node ${nodeType} not found`);
}
}
}

View File

@@ -27,4 +27,7 @@ describe('Drag-and-Drop sidebar', () => {
expect(updatedState.nodes[0].id).toBe(`${nodeType}-0`);
expect(updatedState.nodes[1].id).toBe(`${nodeType}-1`);
});
test('throws error on unexpected node type', () => {
expect(() => addNode('I do not Exist', {x:100, y:100})).toThrow("Node I do not Exist not found");
})
});