📌 Description
useSortableData (src/hooks/useSortableData.ts) returns { sorted, sort, requestSort, clearSort }, where clearSort resets the sort state to null in a single call regardless of the current key/direction. All three tables that use the hook — AnchorTable, SettlementTable, and PoolTable (src/components/AnchorTable.tsx, SettlementTable.tsx, PoolTable.tsx) — destructure only { sorted, sort, requestSort }, never clearSort. The only way a user can currently return a table to its unsorted, original order is to click the same active column's header a third time (cycling ascending → descending → unsorted via requestSort), which requires knowing that undocumented three-click cycle and passing back through a descending sort first. clearSort exists specifically to skip that, but no table exposes any control that calls it.
🧩 Requirements and context
- Add a way for a user to jump directly back to a table's unsorted, original order without needing to click through the descending state first, using the hook's existing
clearSort.
- The existing three-click cycle behavior (asc → desc → unsorted) via
requestSort must be unchanged.
- The affordance should be consistent across
AnchorTable, SettlementTable, and PoolTable since all three share the same underlying hook and header component.
🛠️ Suggested execution
- In
src/components/SortableHeader.tsx (or in each table alongside its SortableHeader usages), add a small "Reset sort" control — shown only while a sort is active (sort !== null) — that calls the table's clearSort, wired through in AnchorTable, SettlementTable, and PoolTable.
- Extend
AnchorTable.test.tsx, SettlementTable.test.tsx, and PoolTable.test.tsx with a test that sorts a column, clicks the new reset control, and asserts the table returns to its original, unsorted order without needing three clicks.
✅ Acceptance criteria
🔒 Security notes
No new attack surface; a client-side UI feature reusing an already-implemented hook capability.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
useSortableData(src/hooks/useSortableData.ts) returns{ sorted, sort, requestSort, clearSort }, whereclearSortresets the sort state tonullin a single call regardless of the current key/direction. All three tables that use the hook —AnchorTable,SettlementTable, andPoolTable(src/components/AnchorTable.tsx,SettlementTable.tsx,PoolTable.tsx) — destructure only{ sorted, sort, requestSort }, neverclearSort. The only way a user can currently return a table to its unsorted, original order is to click the same active column's header a third time (cycling ascending → descending → unsorted viarequestSort), which requires knowing that undocumented three-click cycle and passing back through a descending sort first.clearSortexists specifically to skip that, but no table exposes any control that calls it.🧩 Requirements and context
clearSort.requestSortmust be unchanged.AnchorTable,SettlementTable, andPoolTablesince all three share the same underlying hook and header component.🛠️ Suggested execution
src/components/SortableHeader.tsx(or in each table alongside itsSortableHeaderusages), add a small "Reset sort" control — shown only while a sort is active (sort !== null) — that calls the table'sclearSort, wired through inAnchorTable,SettlementTable, andPoolTable.AnchorTable.test.tsx,SettlementTable.test.tsx, andPoolTable.test.tsxwith a test that sorts a column, clicks the new reset control, and asserts the table returns to its original, unsorted order without needing three clicks.✅ Acceptance criteria
🔒 Security notes
No new attack surface; a client-side UI feature reusing an already-implemented hook capability.
📋 Guidelines