Skip to content

DEV: Add backwards-compatible tag object handling - #50

Merged
tgxworld merged 1 commit into
mainfrom
fix/tag-object-compatibility
Jan 29, 2026
Merged

DEV: Add backwards-compatible tag object handling#50
tgxworld merged 1 commit into
mainfrom
fix/tag-object-compatibility

Conversation

@tgxworld

@tgxworld tgxworld commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

What is the problem?

Discourse core PR #36678 changes tags from strings to objects
with { id, name, slug } format. The iconTagRenderer function
in this theme calls tag.toLowerCase() which fails when tag
is an object instead of a string.

What is the solution?

Extract the tag name using the same pattern as core's defaultRenderTag:
const tagName = typeof tag === "string" ? tag : tag.name

This maintains backwards compatibility with Discourse versions before
the change.

discourse/discourse#36678

What is the problem?

Discourse core PR #36678 changes tags from strings to objects
with `{ id, name, slug }` format. The `iconTagRenderer` function
in this theme calls `tag.toLowerCase()` which fails when `tag`
is an object instead of a string.

What is the solution?

Extract the tag name using the same pattern as core's `defaultRenderTag`:
`const tagName = typeof tag === "string" ? tag : tag.name`

This maintains backwards compatibility with Discourse versions before
the change.

discourse/discourse#36678
@tgxworld
tgxworld force-pushed the fix/tag-object-compatibility branch from 30155a5 to 4ea9e2f Compare January 29, 2026 03:35
@tgxworld
tgxworld merged commit 762c6f7 into main Jan 29, 2026
5 checks passed
@tgxworld
tgxworld deleted the fix/tag-object-compatibility branch January 29, 2026 04:01
@pmusaraj

Copy link
Copy Markdown
Contributor

Thank you @tgxworld and @nattsw (and sorry, I missed this regression)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants