diff --git a/components/DataGrid.tsx b/components/DataGrid.tsx index d07aa72..fbc5c4f 100644 --- a/components/DataGrid.tsx +++ b/components/DataGrid.tsx @@ -334,7 +334,8 @@ const DataGrid: React.FC = ({ data }) => { // 2. Sort if (sortConfig.key) { - result.sort((a, b) => { + // Create a copy to avoid mutating the original array and ensure React detects the change + result = [...result].sort((a, b) => { let valA: number | string = ''; let valB: number | string = '';