Skip to content

Commit 4861b05

Browse files
authored
Fix/perf startup (#417)
* perf: solves issue at start * chore: generate unique ids for keep open state * fix: performance issues * feat: loading render method * chore: remove loading * chore: remove not supported function * chore: made code shorter
1 parent 68cd8ca commit 4861b05

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/nested-list-view/nested-list-view.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const NestedListView: React.FC<IProps> = React.memo(
5959
(node?: INode) => {
6060
if (!node) {
6161
return {
62-
_internalId: hashObjectGenerator({}),
62+
_internalId: '',
6363
};
6464
}
6565

@@ -86,11 +86,17 @@ const NestedListView: React.FC<IProps> = React.memo(
8686
delete copyNode._internalId;
8787
}
8888

89-
copyNode._internalId = hashObjectGenerator(copyNode);
89+
copyNode._internalId = keepOpenedState
90+
? hashObjectGenerator(copyNode, {
91+
algorithm: 'passthrough',
92+
unorderedSets: false,
93+
unorderedObjects: false,
94+
})
95+
: Math.random().toString(36).substring(2, 10);
9096

9197
return copyNode;
9298
},
93-
[getChildrenName],
99+
[getChildrenName, keepOpenedState],
94100
);
95101

96102
const generateRootNode = useCallback(

0 commit comments

Comments
 (0)