feat: add RelevantForm #918 (#1344)

### What problem does this PR solve?

feat: add RelevantForm #918

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-07-03 10:15:19 +08:00
committed by GitHub
parent 25c4c717cb
commit a7423e3a94
13 changed files with 237 additions and 82 deletions

View File

@@ -107,9 +107,15 @@ const useGraphStore = create<RFState>()(
return get().edges.find((x) => x.id === id);
},
deletePreviousEdgeOfClassificationNode: (connection: Connection) => {
// Delete the edge on the classification node anchor when the anchor is connected to other nodes
// Delete the edge on the classification node or relevant node anchor when the anchor is connected to other nodes
const { edges, getOperatorTypeFromId } = get();
if (getOperatorTypeFromId(connection.source) === Operator.Categorize) {
// the node containing the anchor
const anchoredNodes = [Operator.Categorize, Operator.Relevant];
if (
anchoredNodes.some(
(x) => x === getOperatorTypeFromId(connection.source),
)
) {
const previousEdge = edges.find(
(x) =>
x.source === connection.source &&