Users list only partial?

AI-generated summary

Users reported that the user directory on Discourse was only displaying a partial list of users, failing to load additional pages via infinite scroll—especially on desktop. patrickemin first raised the issue, which was reproducible on Meta by JammyDodger and Moin. martin investigated and suspected a race condition, possibly linked to the User Card Directory theme component mentioned by JammyDodger. Moin noted inconsistent behavior tied to viewport width and time filters. A breakthrough came from cathys, who identified that the .load-more-sentinel div had zero height, preventing IntersectionObserver from triggering. Their simple CSS fix—setting height: 1px—resolved the issue for patrickemin and Moin. kelv merged the fix into Discourse core via PR #35262, ensuring all users benefit. cathys shared their GitHub for future contributions, and j.jaffeux thanked them. The bug appears fully resolved.

Hi, how come my users list is only showing a small percentage of all my users? Were are the others? Thanks.

https://mysite/u?cards=no&order=days_visited&period=all

2 Likes

Looks like this can be repro’d here on meta with just the basic user list too https://meta.discourse.org/u

Seems to not be loading any extra pages when I hit the ‘bottom’. (iPhone/safari)

Let’s slip it over to bug for someone to have a look :eyes:

5 Likes

Thanks for letting us know, I informed the team and prioritized! We will get this sorted in the upcoming weeks.

1 Like

I can reproduce this here on Meta, but weirdly not in my local setup. Error is here in the users controller:

It’s like it’s being called too early in some cases, will investigate.

1 Like

Still not really reproducing locally, but this PR should help with it, I will get @kelv to review because he moved this to an observer initially:

https://github.com/discourse/discourse/pull/33122

2 Likes

Just on the off-chance you’ve not considered it, is this connected to having the User Card Directory theme component? I think that’s a thing meta and the OP have in common that you may not have on your test site?

3 Likes

Thanks for that, I will give that a try. I did randomly get Meta not to error on this page today so I think there is some race condition, but yes could well be the component having an impact too.

3 Likes

I sometimes had the impression it was related to the width. I had a repro where collapsing the sidebar fixed it. But I also had repros where, even though the sidebar was visible, loading more worked once or twice or didn’t break. Those happened with different timespans selected, which didn’t make sense to me. Why should it work once when I select “Month” but twice when I select “Quarter”? If you think it’s helpful, I can look for the screencasts I made last week.

1 Like

A post was split to a new topic: User stats incorrect in user directory

I can still reproduce the issue here on Meta.

2 Likes

Hmm weird, thanks for digging into this a bit Moin, will try another fix, not sure why the LoadMore change didn’t solve it.

1 Like

I’ve just noticed that the user list seems to be working for me now. :+1:

Has yours resolved as well @patrickemin?

I’ll update before tomorrow and let you know, thanks.

1 Like

Hi, just updated my Discourse, but no, only around 40 members only show in my 610 members list.

1 Like

I noticed that infinite scroll works fine on mobile, but not on desktop/Nest Hub sizes. After looking into it, it seems the .load-more-sentinel div has zero height, so the IntersectionObserver was never triggered.

A very simple fix I did is to give the sentinel a small height (e.g., 1px).

.load-more-sentinel {
    height: 1px;
}

I tested this on Meta as well and it seems to fix the issue.

5 Likes

Thanks, the fix is working, thanks a lot !

Great that this worked for you, and thanks for your contribution :slight_smile: I merged in this fix so other users of Discourse will benefit from this too. Hopefully this fully resolves the bug!

3 Likes

Works great for me. I was able to reproduce it very reliably on my tablet before. :partying_face:

Would you split post #11 into a new topic? Obviously, it’s unrelated because I still see some wrong numbers in the user directory when I follow the steps. Thank you

1 Like

You’re welcome. This is my github, happy to contribute more directly in the future!

2 Likes