child nodes without __sn now remove without error (#307)

This commit is contained in:
Justin Halsall
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 58504e7d77
commit 95dd144227
3 changed files with 121 additions and 7 deletions

View File

@@ -307,9 +307,11 @@ export class TreeIndex {
const deepRemoveFromMirror = (id: number) => {
this.removeIdSet.add(id);
const node = mirror.getNode(id);
node?.childNodes.forEach((childNode) =>
deepRemoveFromMirror(((childNode as unknown) as INode).__sn.id),
);
node?.childNodes.forEach((childNode) => {
if ('__sn' in childNode) {
deepRemoveFromMirror(((childNode as unknown) as INode).__sn.id)
}
});
};
const deepRemoveFromTreeIndex = (node: TreeNode) => {
this.removeIdSet.add(node.id);