"Add required tag group" not working for a new category

AI-generated summary

A bug report was submitted regarding the “Add required tag group” feature in Discourse 3.1.0.beta2, where clicking the button during new category creation results in a JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'pushObject'). The issue occurs on Linux with Chrome 110.0.5481.77 and is reproducible in safe mode. The error prevents the functionality from working, though a workaround exists: saving the category first allows the button to function. jlc provided a detailed report with steps and a video. Canapin confirmed the issue, and selase acknowledged it and fixed the bug in a pull request. zogstrip requested a review, and selase confirmed the fix was implemented.

Priority/Severity: low

Platform: Linux with Chrome 110.0.5481.77, Discourse 3.1.0.beta2 (d84d38cbe7)

Description: Attempting to use the “Add required tag group” button when creating a new category leads to the following JavaScript exception:

Uncaught TypeError: Cannot read properties of undefined (reading 'pushObject')
    at e.addRequiredTagGroup (edit-category-tags.js:22:1)
    at $._run (index.ts:665:23)
    at $._join (index.ts:640:19)
    at $.join (index.ts:362:17)
    at p (index.js:157:1)
    at index.js:708:1
    at a (index.js:128:1)
    at index.js:707:1
    at index.js:666:1
    at d._triggerAction (d-button.js:116:1)
    at d.click (d-button.js:80:1)

Reproducible steps:

  1. Enter safe mode.
  2. Choose to create a new category.
  3. Choose the “Tags” configuration tab, then activate the “Add required tag group” button.
  4. Nothing visible happens, and the exception trace listed above is logged to the error console.

Workaround: First save the new category, then the button works as expected.

4 Likes

I’m able to repro this issue. :slight_smile:

4 Likes

@selase would you mind having a quick look at this one?

3 Likes

Sure! Looking into it.

2 Likes

@jlc Thanks for the detailed report. This has been fixed.

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

4 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.