| 122 | // We use wrapper objects to avoid mutating the original node data. |
| 123 | const allCheckedNodes = []; |
| 124 | const collectAllCheckedNodes = (n) => { |
| 125 | if (!n) return; |
| 126 | const state = newState[n.id]; |
| 127 | if (state === true || state === 'indeterminate') { |
| 128 | // Pass wrapper object with isIndeterminate flag to differentiate |
| 129 | // full schema selection from partial selection in backup dialog |
| 130 | allCheckedNodes.push({ |
| 131 | node: n, |
| 132 | isIndeterminate: state === 'indeterminate' |
| 133 | }); |
| 134 | } |
| 135 | // Recursively check all children |
| 136 | n.children?.forEach(child => { collectAllCheckedNodes(child); }); |
| 137 | }; |
| 138 | |
| 139 | // Navigate up to find the root level of the tree (parent of root nodes is '__root__') |
| 140 | let rootNode = node; |