@@ -88,7 +88,7 @@ export default function PgTreeView({ data = [], hasCheckbox = false,
8888 // Update the clicked node and all its descendants with the new checked value
8989 const updateDescendants = ( n , val ) => {
9090 newState [ n . id ] = val ;
91- n . children ?. forEach ( child => updateDescendants ( child , val ) ) ;
91+ n . children ?. forEach ( child => { updateDescendants ( child , val ) ; } ) ;
9292 } ;
9393 updateDescendants ( node , isChecked ) ;
9494
@@ -118,19 +118,22 @@ export default function PgTreeView({ data = [], hasCheckbox = false,
118118 setCheckedState ( newState ) ;
119119
120120 // Collect all checked/indeterminate nodes from the entire tree
121- // to provide complete selection state to selectionChange callback.
121+ // to provide complete selection state to selectionChange callback.
122+ // We use wrapper objects to avoid mutating the original node data.
122123 const allCheckedNodes = [ ] ;
123124 const collectAllCheckedNodes = ( n ) => {
124125 if ( ! n ) return ;
125126 const state = newState [ n . id ] ;
126127 if ( state === true || state === 'indeterminate' ) {
127- // Set isIndeterminate flag to differentiate full schema selection
128- // from partial selection (only specific tables) in backup dialog
129- n . data . isIndeterminate = ( state === 'indeterminate' ) ;
130- allCheckedNodes . push ( n ) ;
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+ } ) ;
131134 }
132135 // Recursively check all children
133- n . children ?. forEach ( child => collectAllCheckedNodes ( child ) ) ;
136+ n . children ?. forEach ( child => { collectAllCheckedNodes ( child ) ; } ) ;
134137 } ;
135138
136139 // Navigate up to find the root level of the tree (parent of root nodes is '__root__')
@@ -143,7 +146,7 @@ export default function PgTreeView({ data = [], hasCheckbox = false,
143146 const rootParent = rootNode . parent ;
144147 if ( rootParent && rootParent . children ) {
145148 // Iterate through all sibling root nodes to collect all checked nodes
146- rootParent . children . forEach ( root => collectAllCheckedNodes ( root ) ) ;
149+ rootParent . children . forEach ( root => { collectAllCheckedNodes ( root ) ; } ) ;
147150 } else {
148151 // Fallback: if we can't find siblings, just traverse from the found root
149152 collectAllCheckedNodes ( rootNode ) ;
0 commit comments