You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/08/26 05:03:23 UTC
[inlong] 02/08: [INLONG-5696][Dashboard] EditableTable value update error when columns change (#5697)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch release-1.3.0
in repository https://gitbox.apache.org/repos/asf/inlong.git
commit e625854f186939127fbf15b8b0a49ac78b4dd84a
Author: Daniel <le...@apache.org>
AuthorDate: Thu Aug 25 17:29:49 2022 +0800
[INLONG-5696][Dashboard] EditableTable value update error when columns change (#5697)
---
inlong-dashboard/src/components/EditableTable/index.tsx | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/inlong-dashboard/src/components/EditableTable/index.tsx b/inlong-dashboard/src/components/EditableTable/index.tsx
index 84b432160..ee4cc5885 100644
--- a/inlong-dashboard/src/components/EditableTable/index.tsx
+++ b/inlong-dashboard/src/components/EditableTable/index.tsx
@@ -73,7 +73,7 @@ const getRowInitialValue = (columns: EditableTableProps['columns']) =>
[cur.dataIndex]: cur.initialValue,
}),
{
- _etid: Math.random().toString(),
+ _etid: `_etnew_${Math.random().toString()}`, // The tag of new.
},
);
@@ -104,13 +104,7 @@ const Comp = ({
const { t } = useTranslation();
const [data, setData] = useState<RecordType[]>(
- addIdToValues(value) ||
- (required
- ? [getRowInitialValue(columns)].map(item => ({
- ...item,
- _etid: `_etnew_${item._etid}`, // The tag of new.
- }))
- : []),
+ addIdToValues(value) || (required ? [getRowInitialValue(columns)] : []),
);
const [colsSet, setColsSet] = useState(new Set(columns.map(item => item.dataIndex)));