mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:25:22 +02:00
Fix: Resolve array mutation bug preventing Grid sorting from working
- Changed result.sort() to result = [...result].sort() to create new array reference - React now properly detects changes and re-renders sorted data - All columns (Sell Out, Units, S.O. Δ%, Units Δ%) now sort correctly - Verified with comprehensive browser testing
This commit is contained in:
@@ -334,7 +334,8 @@ const DataGrid: React.FC<DataGridProps> = ({ 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 = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user