mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-04-25 19:52:21 +00:00
## Problem All table sorting on the Nodes page was broken — clicking column headers did nothing. Affected: - Nodes list table - Node detail → Neighbors table - Node detail → Observers table ## Root Cause **Not a race condition** — the actual bug was a **data attribute mismatch**. `TableSort.init()` (in `table-sort.js`) queries for `th[data-sort-key]` to find sortable columns. But all table headers in `nodes.js` used `data-sort="..."` instead of `data-sort-key="..."`. The selector never matched any headers, so no click handlers were attached and sorting silently failed. Additionally, `data-type="number"` was used but TableSort's built-in comparator is named `numeric`, causing numeric columns to fall back to text comparison. The packets table (`packets.js`) was unaffected because it already used the correct `data-sort-key` and `data-type="numeric"` attributes. ## Fix 1. **`public/nodes.js`**: Changed all `data-sort="..."` to `data-sort-key="..."` on `<th>` elements (nodes list, neighbors table, observers table) 2. **`public/nodes.js`**: Changed `data-type="number"` to `data-type="numeric"` to match TableSort's comparator names 3. **`public/packets.js`**: Added timestamp tiebreaker to packet sort for stable ordering when primary column values are equal ## Testing - All existing tests pass (`npm test`) - No changes to test infrastructure needed — this was a pure HTML attribute fix Fixes #679 --------- Co-authored-by: you <you@example.com>