mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 16:59:03 +08:00
feat: use useUpdateNodeInternals to solve the issue that the newly ad… (#1287)
### What problem does this PR solve? feat: use useUpdateNodeInternals to solve the issue that the newly added anchor points cannot be connected. #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
038ca8c0ea
commit
a943aefa4d
@ -1,5 +1,6 @@
|
|||||||
import { CloseOutlined } from '@ant-design/icons';
|
import { CloseOutlined } from '@ant-design/icons';
|
||||||
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
||||||
|
import { useUpdateNodeInternals } from 'reactflow';
|
||||||
import { useBuildCategorizeToOptions, useHandleToSelectChange } from './hooks';
|
import { useBuildCategorizeToOptions, useHandleToSelectChange } from './hooks';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
@ -7,6 +8,7 @@ interface IProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DynamicCategorize = ({ nodeId }: IProps) => {
|
const DynamicCategorize = ({ nodeId }: IProps) => {
|
||||||
|
const updateNodeInternals = useUpdateNodeInternals();
|
||||||
const form = Form.useFormInstance();
|
const form = Form.useFormInstance();
|
||||||
const options = useBuildCategorizeToOptions();
|
const options = useBuildCategorizeToOptions();
|
||||||
const { handleSelectChange } = useHandleToSelectChange(
|
const { handleSelectChange } = useHandleToSelectChange(
|
||||||
@ -21,6 +23,7 @@ const DynamicCategorize = ({ nodeId }: IProps) => {
|
|||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
const idx = fields.length;
|
const idx = fields.length;
|
||||||
add({ name: `Categorize ${idx + 1}` });
|
add({ name: `Categorize ${idx + 1}` });
|
||||||
|
if (nodeId) updateNodeInternals(nodeId);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
Loading…
x
Reference in New Issue
Block a user