web
web copied to clipboard
Fix sorting on peers table
The peers list table has carets in the column headings, indicating that it should be possible to sort by those fields, which does not seem to be the case.
The PR enables sorting by clicking column heading, and defaults to most recent contacts at the top
Closes #146
Hi @geftactics,
I checked out your code to test it out.
The sort is working but there is an edge case I wanted to bring up. I think you will need to update the table state to resort when the web client receives node information. To do that however there is a deeper problem. This table's rows can change dynamically so using index as a key can lead to issues with DOM updates and I think its also contributing to a bug which is messing with your sort.
I tested this patch on my node and it worked well.
It did require clicking the heading to re-sort when new data comes in, but it was still a better experience than no sorting at all :D
This has been fixed in another PR.
~~@geftactics I get an error when sorting by the new "Connection" column that was added:~~
~~The other columns work fine so I'm sure it's a simple fix.~~
~~Let me know if you need me to fix this bug, if not just update this PR and I'll merge it.~~
~~I'll check back in a week or so and fix it if it's not done by then.~~
Sorting "Last Heard" doesn't seem to work:
Good work @geftactics