@@ -255,7 +255,7 @@ export const RowSelection: TableFeature = {
255
255
const rowSelection : RowSelectionState = { ...old }
256
256
257
257
table . getRowModel ( ) . rows . forEach ( row => {
258
- mutateRowIsSelected ( rowSelection , row . id , resolvedValue , table )
258
+ mutateRowIsSelected ( rowSelection , row . id , resolvedValue , true , table )
259
259
} )
260
260
261
261
return rowSelection
@@ -487,9 +487,13 @@ export const RowSelection: TableFeature = {
487
487
488
488
const selectedRowIds = { ...old }
489
489
490
- if ( opts ?. selectChildren ?? true ) {
491
- mutateRowIsSelected ( selectedRowIds , row . id , value , table )
492
- }
490
+ mutateRowIsSelected (
491
+ selectedRowIds ,
492
+ row . id ,
493
+ value ,
494
+ opts ?. selectChildren ?? true ,
495
+ table
496
+ )
493
497
494
498
return selectedRowIds
495
499
} )
@@ -549,6 +553,7 @@ const mutateRowIsSelected = <TData extends RowData>(
549
553
selectedRowIds : Record < string , boolean > ,
550
554
id : string ,
551
555
value : boolean ,
556
+ includeChildren : boolean ,
552
557
table : Table < TData >
553
558
) => {
554
559
const row = table . getRow ( id )
@@ -571,9 +576,9 @@ const mutateRowIsSelected = <TData extends RowData>(
571
576
}
572
577
// }
573
578
574
- if ( row . subRows ?. length && row . getCanSelectSubRows ( ) ) {
579
+ if ( includeChildren && row . subRows ?. length && row . getCanSelectSubRows ( ) ) {
575
580
row . subRows . forEach ( row =>
576
- mutateRowIsSelected ( selectedRowIds , row . id , value , table )
581
+ mutateRowIsSelected ( selectedRowIds , row . id , value , includeChildren , table )
577
582
)
578
583
}
579
584
}
0 commit comments