@@ -1912,12 +1912,7 @@ export const TorrentTableOptimized = memo(function TorrentTableOptimized({
19121912 }
19131913 } , [ filters , effectiveSearch , instanceId , virtualizer , sortedTorrents . length , lastUserAction , resetSelectionState ] )
19141914
1915- // Clear selection handler for keyboard navigation
1916- const clearSelection = useCallback ( ( ) => {
1917- resetSelectionState ( )
1918- } , [ resetSelectionState ] )
1919-
1920- // Set up keyboard navigation with selection clearing
1915+ // Set up keyboard navigation (PageUp/Down, Home/End)
19211916 useKeyboardNavigation ( {
19221917 parentRef,
19231918 virtualizer,
@@ -1926,8 +1921,6 @@ export const TorrentTableOptimized = memo(function TorrentTableOptimized({
19261921 isLoadingMore,
19271922 loadMore,
19281923 estimatedRowHeight,
1929- onClearSelection : clearSelection ,
1930- hasSelection : isAllSelected || selectedRowIds . length > 0 ,
19311924 } )
19321925
19331926 // Apply Ctrl/Cmd+A shortcut to select all torrents
@@ -2609,6 +2602,17 @@ export const TorrentTableOptimized = memo(function TorrentTableOptimized({
26092602 handleRowSelection ( torrent . hash , ! isRowSelected , row . id )
26102603 lastSelectedIndexRef . current = currentIndex
26112604 } else {
2605+ // Plain click - open details panel
2606+ // If row is already selected, keep selection intact
2607+ // Otherwise, select only this torrent (replace selection)
2608+ if ( ! isRowSelected ) {
2609+ const allRows = table . getRowModel ( ) . rows
2610+ const currentIndex = allRows . findIndex ( r => r . id === row . id )
2611+ setIsAllSelected ( false )
2612+ setExcludedFromSelectAll ( new Set ( ) )
2613+ setRowSelection ( { [ row . id ] : true } )
2614+ lastSelectedIndexRef . current = currentIndex
2615+ }
26122616 onTorrentSelect ?.( torrent )
26132617 }
26142618 } }
@@ -2722,7 +2726,17 @@ export const TorrentTableOptimized = memo(function TorrentTableOptimized({
27222726 handleRowSelection ( torrent . hash , ! isRowSelected , row . id )
27232727 lastSelectedIndexRef . current = currentIndex
27242728 } else {
2725- // Plain click - open details without changing checkbox selection state
2729+ // Plain click - open details panel
2730+ // If row is already selected, keep selection intact
2731+ // Otherwise, select only this torrent (replace selection)
2732+ if ( ! isRowSelected ) {
2733+ const allRows = table . getRowModel ( ) . rows
2734+ const currentIndex = allRows . findIndex ( r => r . id === row . id )
2735+ setIsAllSelected ( false )
2736+ setExcludedFromSelectAll ( new Set ( ) )
2737+ setRowSelection ( { [ row . id ] : true } )
2738+ lastSelectedIndexRef . current = currentIndex
2739+ }
27262740 onTorrentSelect ?.( torrent )
27272741 }
27282742 }
0 commit comments