Skip to content

Commit

Permalink
fix(Table): data should be mutable for async load
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna authored and 潕量 committed Mar 25, 2022
1 parent b0f732e commit 3653a02
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/table/tree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
});
};
Expand Down

0 comments on commit 3653a02

Please sign in to comment.