Skip to:
Content

BuddyPress.org

Opened 2 months ago

Last modified 4 weeks ago

#9268 new defect (bug)

Unexpected behaviour with Friends List default sorting

Reported by: yatesa01's profile yatesa01 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: (not sure) Keywords: has-patch
Cc:

Description

There seems to be a bug in the expected behaviour of the sorting of friendship lists and friendship request lists on the user profile. When a user visits their friendship list or request list, even though the drop down sort menu shows that it is set to “alphabetical” the actual sorting is “last active.”

To switch it to “Alphabetical” the user must first change it to “last active” before changing it back to “alphabetical.” But this is only a temporary fix–after a reload of the page, it goes back to sorting to “last active” regardless of what the drop down menu says it is doing.

To make matters worse, if a user has more than one page of friends, they cannot view a second page or beyond of alphabetically sorted friends from their profile. When they click to page two, the sorting resets to “Last Active.”

I'm on BuddyPress 14.3.3, on WordPress 6.7.1 using the Astra theme.

Attachments (3)

Screen Recording 2025-01-30 at 9.43.32 PM.mov (6.5 MB) - added by pratiklondhe 8 weeks ago.
9268.diff (656 bytes) - added by pratiklondhe 7 weeks ago.
patch for the fix
Screen Recording 2025-02-09 at 9.29.51 PM.mov (1.8 MB) - added by pratiklondhe 7 weeks ago.

Change History (11)

#1 follow-up: @espellcaste
2 months ago

Could you share which template pack you are using?

#2 in reply to: ↑ 1 @yatesa01
2 months ago

Replying to espellcaste:

Could you share which template pack you are using?

BP Nouveau

#3 @pratiklondhe
8 weeks ago

I have successfully replicated this error locally and would like to contribute to resolving it by debugging and implementing a fix.

#4 @pratiklondhe
8 weeks ago

The issue occurs in a slightly different way. Initially, when I log in, the default option is set to Last Active, and the list loads as expected. If I switch to Alphabetically, the list sorts correctly in alphabetical order. However, after refreshing the page, the Alphabetically option remains selected, but the list reverts to being sorted by Last Active. I've attached a video demonstrating this behavior.

@pratiklondhe
7 weeks ago

patch for the fix

#5 @pratiklondhe
7 weeks ago

  • Keywords has-patch needs-testing added

More details found after debugging:

  • The issue appears to be with session storage keys. While the selected filter information is stored under the bp-friends key, the AJAX call accesses bp-members, causing incorrect data to be sent despite the correct filter being displayed.
  • After further investigation, it seems the object variable passed to the AJAX function is set to "members". When the filter is updated, the bp-friends storage key gets updated, but bp-members remains unchanged. This suggests an issue with how these keys are being set.
  • Since I don’t have a complete understanding of this, I am submitting a patch to update the bp-members keys. The root cause seems to be a mismatch between data-bp-components and data-bp-listdata-bp-components is set to "friends", but JavaScript reads it as "members" due to data-bp-list being "members". Updating data-bp-list to "friends" appears to fix the issue.

( attaching a video of the issue fixed )
P.S. This is my first contribution to BuddyPress, so the above analysis might not be entirely accurate. I'm open to suggestions and feedback to improve the fix if there's a better approach.

#6 @yatesa01
7 weeks ago

@pratiklondhe I made the change that is in your patch and it has fixed the issue for me. Thank you for figuring it out. Not sure how much testing you need.

#7 @pratiklondhe
6 weeks ago

  • Keywords needs-testing removed

@yatesa01 , you testing the fix is enough testing

This ticket was mentioned in Slack in #buddypress by pratiklondhe. View the logs.


4 weeks ago

Note: See TracTickets for help on using tickets.