File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,7 @@ export function DataTable<T extends Record<string, any>>({
200200
201201 // Sort rows
202202 const sortedRows = React . useMemo ( ( ) => {
203+ if ( ! filteredRows || ! Array . isArray ( filteredRows ) ) return [ ] ;
203204 if ( ! orderBy ) return filteredRows ;
204205
205206 return [ ...filteredRows ] . sort ( ( a , b ) => {
@@ -214,10 +215,9 @@ export function DataTable<T extends Record<string, any>>({
214215 } , [ filteredRows , order , orderBy ] ) ;
215216
216217 // Paginate rows - with safety check
217- const paginatedRows = sortedRows ?. slice (
218- page * rowsPerPage ,
219- page * rowsPerPage + rowsPerPage
220- ) || [ ] ;
218+ const paginatedRows = Array . isArray ( sortedRows )
219+ ? sortedRows . slice ( page * rowsPerPage , page * rowsPerPage + rowsPerPage )
220+ : [ ] ;
221221
222222 // Show action column if any action handler is provided
223223 const showActions = ! ! ( onEdit || onDelete || onView ) ;
You can’t perform that action at this time.
0 commit comments