fix: monitor changes in the data.form field of the categorize and relevant operators and then synchronize them to the edge #918 (#1469)

### What problem does this PR solve?
feat: monitor changes in the table of relevant operators and synchronize
them to the edge #918
feat: fixed the issue of repeated requests when opening the graph page
#918
feat: cache node anchor coordinate information #918
feat: monitor changes in the data.form field of the categorize and
relevant operators and then synchronize them to the edge #918
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-07-11 18:01:50 +08:00
committed by GitHub
parent 7f4c63d102
commit 8d7fb12305
14 changed files with 252 additions and 72 deletions

View File

@ -27,12 +27,10 @@ export const useHandleOperateParameters = (nodeId: string) => {
const { getNode, updateNodeForm } = useGraphStore((state) => state);
const node = getNode(nodeId);
const dataSource: IGenerateParameter[] = useMemo(
() => get(node, 'data.form.parameters', []),
() => get(node, 'data.form.parameters', []) as IGenerateParameter[],
[node],
);
// const [x, setDataSource] = useState<IGenerateParameter[]>([]);
const handleComponentIdChange = useCallback(
(row: IGenerateParameter) => (value: string) => {
const newData = [...dataSource];
@ -44,7 +42,6 @@ export const useHandleOperateParameters = (nodeId: string) => {
});
updateNodeForm(nodeId, { parameters: newData });
// setDataSource(newData);
},
[updateNodeForm, nodeId, dataSource],
);
@ -53,20 +50,11 @@ export const useHandleOperateParameters = (nodeId: string) => {
(id?: string) => () => {
const newData = dataSource.filter((item) => item.id !== id);
updateNodeForm(nodeId, { parameters: newData });
// setDataSource(newData);
},
[updateNodeForm, nodeId, dataSource],
);
const handleAdd = useCallback(() => {
// setDataSource((state) => [
// ...state,
// {
// id: uuid(),
// key: '',
// component_id: undefined,
// },
// ]);
updateNodeForm(nodeId, {
parameters: [
...dataSource,
@ -89,7 +77,6 @@ export const useHandleOperateParameters = (nodeId: string) => {
});
updateNodeForm(nodeId, { parameters: newData });
// setDataSource(newData);
};
return {