@@ -98,8 +98,8 @@ type TableColProps<T> = {
98
98
onDragEnd : ( e : React . DragEvent < HTMLDivElement > ) => void ;
99
99
onDragEnter : ( e : React . DragEvent < HTMLDivElement > ) => void ;
100
100
onDragLeave : ( e : React . DragEvent < HTMLDivElement > ) => void ;
101
- currentSortColumnId : string | number | null ;
102
- currentSortDirection : SortOrder ;
101
+ currentSortColumnId ? : string | number | null ;
102
+ currentSortDirection ? : SortOrder ;
103
103
} ;
104
104
105
105
function TableCol < T > ( {
@@ -172,14 +172,19 @@ function TableCol<T>({
172
172
} ;
173
173
174
174
const renderNativeSortIcon = ( sortActive : boolean ) => (
175
- < NativeSortIcon sortActive = { sortActive } sortDirection = { currentSortDirection } />
175
+ < NativeSortIcon sortActive = { sortActive } sortDirection = { currentSortDirection ?? sortDirection } />
176
176
) ;
177
177
178
178
const renderCustomSortIcon = ( ) => (
179
179
< span className = { [ sortDirection , '__rdt_custom_sort_icon__' ] . join ( ' ' ) } > { sortIcon } </ span >
180
180
) ;
181
181
182
- const sortActive = ! ! ( column . sortable && currentSortColumnId !== null && equalizeId ( currentSortColumnId , column . id ) ) ;
182
+ const sortActive = ( ( ) => {
183
+ if ( currentSortColumnId !== null ) {
184
+ return ! ! ( column . sortable && equalizeId ( currentSortColumnId , column . id ) ) ;
185
+ }
186
+ return ! ! ( column . sortable && equalizeId ( selectedColumn . id , column . id ) ) ;
187
+ } ) ( ) ;
183
188
const disableSort = ! column . sortable || disabled ;
184
189
const nativeSortIconLeft = column . sortable && ! sortIcon && ! column . right ;
185
190
const nativeSortIconRight = column . sortable && ! sortIcon && column . right ;
0 commit comments