📌 Description
useSortableData<T, K> (src/hooks/useSortableData.ts) backs the sortable columns on AnchorTable, PoolTable, and SettlementTable. useSortableData.test.ts likely covers single-key ascending/descending sorts, but ties on the primary sort key (e.g. multiple settlements with the same status) aren't explicitly tested for stable ordering, which matters for a predictable UI when a user sorts a table with many equal values.
🧩 Requirements and context
- Add a test asserting rows with equal values on the active sort key retain their original relative order (stable sort) rather than reshuffling arbitrarily.
- Verify this holds across both ascending and descending directions.
- Fix
useSortableData.ts if it's found to use a non-stable comparator (e.g. relying on Array.prototype.sort without a documented tie-break) and stability doesn't hold.
🛠️ Suggested execution
- Extend
src/hooks/useSortableData.test.ts with a tied-values fixture and stability assertions.
- Fix the hook if instability is found.
- Spot-check
AnchorTable.test.tsx/SettlementTable.test.tsx for an equivalent integration-level assertion.
✅ Acceptance criteria
🔒 Security notes
No new attack surface; purely a UI-correctness concern.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
useSortableData<T, K>(src/hooks/useSortableData.ts) backs the sortable columns onAnchorTable,PoolTable, andSettlementTable.useSortableData.test.tslikely covers single-key ascending/descending sorts, but ties on the primary sort key (e.g. multiple settlements with the samestatus) aren't explicitly tested for stable ordering, which matters for a predictable UI when a user sorts a table with many equal values.🧩 Requirements and context
useSortableData.tsif it's found to use a non-stable comparator (e.g. relying onArray.prototype.sortwithout a documented tie-break) and stability doesn't hold.🛠️ Suggested execution
src/hooks/useSortableData.test.tswith a tied-values fixture and stability assertions.AnchorTable.test.tsx/SettlementTable.test.tsxfor an equivalent integration-level assertion.✅ Acceptance criteria
🔒 Security notes
No new attack surface; purely a UI-correctness concern.
📋 Guidelines