Topic link counter stops at 50

AI-generated summary

The link counter at the bottom of a topic in Discourse is not accurately displaying the number of links, stopping at 50 even when there are over 1,000 links. Richie reported this issue and provided screenshots as evidence. Pfaffman suggested that the issue might be related to the topic_links table and later confirmed that the limit is intentional due to performance concerns (#4). Richie argued that showing an inaccurate number is not helpful and proposed finding an alternative solution. Sam suggested a possible fix, which is to select 51 links and display “50+” in the UI if more than 50 links are found. The issue has been moved to a separate topic for further discussion (#7).

Discourse 3.5.0.beta3-dev (afde7cc172).

The link counter displayed at the bottom of a topic seems to stop at 50, even when there are over 1,000 links in the thread:

For reference:

On another topic, this one also says 50:

When there are 250+ links:

Does anyone know what might be causing this? :thinking:

2 Likes

Without looking at the code, I think that number probably comes from topic_links, so something like

select * from topic_links where topic_id=1234

It does seem like a bug, though.

3 Likes

Interesting, hadn’t spotted that table.

If this helps, there are 4,155 links in this topic id yet it says 50x on the front end:

Sounds like a bug. Maybe share the link. Maybe look in the code.

Looks like it’s limited to 50 on purpose; I guess that it’s a complicated join and having it do hundreds or thousands would be a performance issue.

4 Likes

Hmmm :thinking:

Thanks for the confirmation @pfaffman

I don’t know why we’d show a number to the end user which is completely inaccurate :person_shrugging:

No information is better than inaccurate information.

I have an idea for an easy solution which doesn’t involve removing this wrong number completely.

I’ll post a suggestion in Contribute > UX :grin:

1 Like

Yeah this lives between bug and ux.

On one hand it only impacts the UI of Discourse, on the other hand it is buggy to show a number that we know is not correct.

I think the simplest fix on our side is to select 51 and then show the text “50+” in the UI if we get 51.

It feels in the realm of pr-welcome, but I will leave @lindsey to triage and decide.

Oh I see:

So I guess we take it up there.