mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
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:
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user