Opened 2 months ago
Last modified 4 weeks ago
#9268 new defect (bug)
Unexpected behaviour with Friends List default sorting
Reported by: |
|
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)
Change History (11)
#3
@
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
@
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.
#5
@
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 accessesbp-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, butbp-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 betweendata-bp-components
anddata-bp-list
—data-bp-components
is set to "friends", but JavaScript reads it as "members" due todata-bp-list being
"members". Updatingdata-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
@
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.
Could you share which template pack you are using?