From 3653a0293be61a65d239f0443070d5a25fc9d691 Mon Sep 17 00:00:00 2001 From: youluna Date: Wed, 23 Mar 2022 16:06:12 +0800 Subject: [PATCH] fix(Table): data should be mutable for async load --- src/table/tree.jsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/table/tree.jsx b/src/table/tree.jsx index 75a9de9101..3de883c101 100644 --- a/src/table/tree.jsx +++ b/src/table/tree.jsx @@ -94,18 +94,17 @@ export default function tree(BaseComponent) { const ret = [], loop = function(dataSource, level, parentId = null) { dataSource.forEach(item => { - const itemCopy = { ...item }; - itemCopy.__level = level; + item.__level = level; if (level === 0 || openRowKeys.indexOf(parentId) > -1) { - itemCopy.__hidden = false; + item.__hidden = false; } else { - itemCopy.__hidden = true; + item.__hidden = true; } - ret.push(itemCopy); + ret.push(item); - if (itemCopy.children) { - loop(itemCopy.children, level + 1, itemCopy[primaryKey]); + if (item.children) { + loop(item.children, level + 1, item[primaryKey]); } }); };