New Topic Header Button component: Category is not auto-detected

AI-generated summary

The issue concerns the “New Topic Button” component not automatically detecting the current topic’s category when clicked, a functionality that previously worked. toad notes the button fails to auto-detect the category unless moved to a different location in the UI, such as near the spanner icon or at the bottom of the page. chapo suggests this might be a bug for the team to address, and martin reports being unable to reproduce the issue, providing a video demonstration. chapo finds this odd, while Moin suggests the issue may have been resolved by a recent fix, referencing a GitHub pull request.

The “New Topic Button” component does not automatically detect the category of the current topic when the button is clicked (e.g. on a page that is already in a topic).

This used to work.

In fact I can fix it by changing the code to move the button e.g. to timeline-controls-before (next to the spanner icon), or after-topic-footer-main-buttons (at the bottom with the other buttons). However with the official plugin with the button at the top, auto-detection of the category does not work.

I appreciate that moving the button to the top and making it always appear was intentional. But it appears to have broken the logic that finds the current topic.

For now we are maintaining our own fork which moves the buttons, and thereby fixes the problem.

Thanks!

4 Likes

@martin One for us to pick up I think.

2 Likes

Sorry but I am unable to reproduce, see the video below:

If I am in a category page, or in a topic with a specific category, the new topic header button picks up the category correctly.

That’s odd, I tested yesterday and swear I had a repro :confused:

Maybe you are no longer able to reproduce it because this fixed it:
https://github.com/discourse/discourse-new-topic-button-theme-component/pull/48

2 Likes