Fix inconsistent sorting in FriendList across pagination #142

Closed
opened 2026-04-05 16:16:17 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @paralleltree on 1/10/2026

Summary

Fix sorting issues in the FriendList view to ensure consistent ordering across pages and for rows with missing values.

Background

This PR addresses the issues described in #1556.

The problems are:

  • In the FriendList view, sorting does not work correctly across paginated pages.
  • Rows with missing values in the sorted column have an undefined order, resulting in inconsistent display.

Changes

  • Uses the sort-change event of el-table to apply sorting across all items. This ensures correct sorting even when navigating across pages.
  • Updates the sortAlphabetically method to explicitly define the order when one of the compared values is missing. This makes the order of rows with empty values deterministic.

Screenshots

Before

a. When sorting by spentTime

Page 1 Page 2
image image

On the first page sorted by spentTime, the minimum duration is 1 minute.
As a result, the second page is expected to start with users whose spentTime is 1 minute or less, but users with longer durations are shown instead, leading to inconsistent ordering.

b. When sorting by Last Seen
image

In this view, rows without a value for the Last Seen are interleaved with rows with a Last Seen value, resulting in an incorrect sort order.

After

a. When sorting by spentTime

Page 1 Page 2
image image

On the first page sorted by spentTime, friends are sorted correctly and the second page shows friends whose spentTime is less than or equal to those on the first page.

b. When sorting by Last Seen

image

In this view, friends with the most recent Last Seen values are displayed at the top.

Notes

  • When multiple rows have the same value for the primary sort key, $friendNumber is used as a secondary sort key to ensure stable sorting.
*Originally created by @paralleltree on 1/10/2026* ## Summary Fix sorting issues in the FriendList view to ensure consistent ordering across pages and for rows with missing values. ## Background This PR addresses the issues described in #1556. The problems are: - In the FriendList view, sorting does not work correctly across paginated pages. - Rows with missing values in the sorted column have an undefined order, resulting in inconsistent display. ## Changes - Uses the `sort-change` event of `el-table` to apply sorting across all items. This ensures correct sorting even when navigating across pages. - Updates the `sortAlphabetically` method to explicitly define the order when one of the compared values is missing. This makes the order of rows with empty values deterministic. ## Screenshots ### Before a. When sorting by `spentTime` |Page 1|Page 2| |:--:|:--:| |<img width="143" height="838" alt="image" src="https://github.com/user-attachments/assets/128d8e50-1d81-4973-8f3b-b20b52f60ce6" />|<img width="145" height="638" alt="image" src="https://github.com/user-attachments/assets/30b19d99-0998-41f7-aa35-c8be7c5de67e" />| On the first page sorted by `spentTime`, the minimum duration is 1 minute. As a result, the second page is expected to start with users whose `spentTime` is 1 minute or less, but users with longer durations are shown instead, leading to inconsistent ordering. b. When sorting by Last Seen <img width="149" height="612" alt="image" src="https://github.com/user-attachments/assets/129bc53e-a724-4a46-b971-b732f8b0457a" /> In this view, rows without a value for the Last Seen are interleaved with rows with a Last Seen value, resulting in an incorrect sort order. ### After a. When sorting by spentTime |Page 1|Page 2| |:--:|:--:| |<img width="138" height="730" alt="image" src="https://github.com/user-attachments/assets/602c93dc-05d7-4759-af69-33210b39045c" />|<img width="135" height="396" alt="image" src="https://github.com/user-attachments/assets/2fc6dd83-92c2-4b75-945a-f51fa11dd75e" />| On the first page sorted by `spentTime`, friends are sorted correctly and the second page shows friends whose `spentTime` is less than or equal to those on the first page. b. When sorting by Last Seen <img width="148" height="406" alt="image" src="https://github.com/user-attachments/assets/3a87993d-d5f7-4579-a49c-c025e1778eb2" /> In this view, friends with the most recent Last Seen values are displayed at the top. ## Notes - When multiple rows have the same value for the primary sort key, `$friendNumber` is used as a secondary sort key to ensure stable sorting.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/VRCX#142