balibabu
commited on
Commit
·
b8168a2
1
Parent(s):
eaecaf9
feat: use useUpdateNodeInternals to solve the issue that the newly ad… (#1287)
Browse files### 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)
web/src/pages/flow/categorize-form/dynamic-categorize.tsx
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import { CloseOutlined } from '@ant-design/icons';
|
2 |
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
|
|
3 |
import { useBuildCategorizeToOptions, useHandleToSelectChange } from './hooks';
|
4 |
|
5 |
interface IProps {
|
@@ -7,6 +8,7 @@ interface IProps {
|
|
7 |
}
|
8 |
|
9 |
const DynamicCategorize = ({ nodeId }: IProps) => {
|
|
|
10 |
const form = Form.useFormInstance();
|
11 |
const options = useBuildCategorizeToOptions();
|
12 |
const { handleSelectChange } = useHandleToSelectChange(
|
@@ -21,6 +23,7 @@ const DynamicCategorize = ({ nodeId }: IProps) => {
|
|
21 |
const handleAdd = () => {
|
22 |
const idx = fields.length;
|
23 |
add({ name: `Categorize ${idx + 1}` });
|
|
|
24 |
};
|
25 |
return (
|
26 |
<div
|
|
|
1 |
import { CloseOutlined } from '@ant-design/icons';
|
2 |
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
3 |
+
import { useUpdateNodeInternals } from 'reactflow';
|
4 |
import { useBuildCategorizeToOptions, useHandleToSelectChange } from './hooks';
|
5 |
|
6 |
interface IProps {
|
|
|
8 |
}
|
9 |
|
10 |
const DynamicCategorize = ({ nodeId }: IProps) => {
|
11 |
+
const updateNodeInternals = useUpdateNodeInternals();
|
12 |
const form = Form.useFormInstance();
|
13 |
const options = useBuildCategorizeToOptions();
|
14 |
const { handleSelectChange } = useHandleToSelectChange(
|
|
|
23 |
const handleAdd = () => {
|
24 |
const idx = fields.length;
|
25 |
add({ name: `Categorize ${idx + 1}` });
|
26 |
+
if (nodeId) updateNodeInternals(nodeId);
|
27 |
};
|
28 |
return (
|
29 |
<div
|