Featured Badges breaks user profile page

Hi,

I noticed that the use profile page ends after the headline “Featured Badges”. Nothing more below (especially not the Save button), except the site footer.

Found the following in the developer console:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'split')
    at l.<anonymous> (user-featured-badges.js:12:1)
    at getter (index.js:444:104)
    at l.a [as featuredBadges] (cache-BESCGvbE.js:1878:17)
    at eM (cache-BESCGvbE.js:1647:18)
    at index.js:95:32
    at index.js:75:37
    at Z (index.js:418:5)
    at T (index.js:74:16)
    at eU (index-Cx6axmzR.js:1786:17)
    at eK.create (index-Cx6axmzR.js:1961:17)
    at Object.evaluate (index.js:1393:23)
    at Object.evaluate (index.js:770:198)
    at tq.evaluateSyscall (index.js:3353:20)
    at tq.evaluateInner (index.js:3332:60)
    at tq.evaluateOuter (index.js:3329:10)
    at t1.next (index.js:3990:46)
    at t1._execute (index.js:3979:21)
    at t1.execute (index.js:3955:41)
    at tW.handleException (index.js:3447:19)
    at tJ.handleException (index.js:3595:52)
    at t$.throw (index.js:3400:16)
    at ek.evaluate (index.js:964:42)
    at t$._execute (index.js:3387:34)
    at t$.execute (index.js:3379:17)
    at tQ.rerender (index.js:3613:8)
    at t5.render (index-Cx6axmzR.js:5114:55)
    at index-Cx6axmzR.js:5390:16
    at tD (index.js:2893:7)
    at io._renderRoots (index-Cx6axmzR.js:5370:7)
    at io._renderRootsTransaction (index-Cx6axmzR.js:5418:12)
    at io._revalidate (index-Cx6axmzR.js:5451:10)
    at invoke (index.js:262:14)
    at m.flush (index.js:180:11)
    at g.flush (index.js:334:19)
    at q._end (index.js:762:32)
    at index.js:499:12
2 Likes

Any idea about this problem? What information can I provide for better looking into this problem?

1 Like

…just found out that for another user who has set some featured badges, the profile page loads completely. I did not set any featured badge - maybe that is the reason?

1 Like

Did you try safe mode?

I believe that section is added by the post badges plugin, so it might be a bug in the plugin rather than in core Discourse.

Maybe @Arkshine knows more about this

2 Likes

Thank you for reporting, @Roi, and thank you, @Moin, for bringing this to my attention. I can reproduce it. The issue happens when a user doesn’t have any badges. I’ll make a PR asap.

3 Likes

Thank you! :slight_smile:

Btw, I run this as a plugin. Is that correct or should I run it as theme component?

1 Like

Here we go:

The TC version doesn’t allow users to select the badges in their profiles. It’s a global setting for all users, which is the main difference.

4 Likes

So I understand the plugin version is better?

Thank you for the PR! :slight_smile: Is that for both versions?

It depends on whether you want to let your users control what badges they want to show (plugin) or to have admins control what badges are allowed to be displayed based on the current user’s badges (TC).

It’s a limitation in TC that you can’t do the same as the plugin, but I think both ways have their usage depending on your needs.

1 Like

The PR is merged now and it is working again, thank you again! :slight_smile:

1 Like

Note: bug tracking for third party themes/components or plugins should all be done in the dedicated plugin/theme/component topic or on a 3rd party bug tracker.

2 Likes