feat: build categorize list from object #918 (#1276)

### What problem does this PR solve?

feat: build categorize list from object #918

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-06-25 19:28:24 +08:00
committed by GitHub
parent 83b91d90fe
commit fef663a59d
11 changed files with 208 additions and 69 deletions

View File

@@ -39,6 +39,7 @@ export type RFState = {
deleteEdgeById: (id: string) => void;
deleteNodeById: (id: string) => void;
findNodeByName: (operatorName: Operator) => Node | undefined;
findNodeById: (id: string) => Node | undefined;
};
// this is our useStore hook that we can use in our components to get parts of the store and call actions
@@ -125,6 +126,9 @@ const useGraphStore = create<RFState>()(
findNodeByName: (name: Operator) => {
return get().nodes.find((x) => x.data.label === name);
},
findNodeById: (id: string) => {
return get().nodes.find((x) => x.id === id);
},
updateNodeForm: (nodeId: string, values: any) => {
set({
nodes: get().nodes.map((node) => {