Skip to content

DEV: Add backward compatibility for tag object arrays#92

Merged
tgxworld merged 1 commit intomainfrom
fix-tag-object-compatibility
Jan 19, 2026
Merged

DEV: Add backward compatibility for tag object arrays#92
tgxworld merged 1 commit intomainfrom
fix-tag-object-compatibility

Conversation

@tgxworld
Copy link
Contributor

What is the problem?

Discourse core PR #36678 changes site.top_tags and
site.category_top_tags from string arrays (e.g., ["support", "bug"])
to object arrays (e.g., [{id: 12, name: "support", slug: "support"}]).
This breaks the PopularTags component which filters and displays tags
as strings.

What is the solution?

Normalize the tags array by mapping and extracting names using
typeof tag === "string" ? tag : tag.name before filtering against
excluded tags. This ensures backward compatibility with both the old
string format and the new object format.

@tgxworld tgxworld force-pushed the fix-tag-object-compatibility branch from 481175f to 5f8c00f Compare January 16, 2026 05:27
@tgxworld tgxworld force-pushed the fix-tag-object-compatibility branch 8 times, most recently from 0b7bceb to 7b6fcd4 Compare January 19, 2026 05:00
What is the problem?

Discourse core PR #36678 changes `site.top_tags` and
`site.category_top_tags` from string arrays (e.g., `["support", "bug"]`)
to object arrays (e.g., `[{id: 12, name: "support", slug: "support"}]`).
This breaks the `PopularTags` component which filters and displays tags
as strings.

What is the solution?

Normalize the tags array by mapping and extracting names using
`typeof tag === "string" ? tag : tag.name` before filtering against
excluded tags. This ensures backward compatibility with both the old
string format and the new object format.
@tgxworld tgxworld force-pushed the fix-tag-object-compatibility branch from 7b6fcd4 to e246733 Compare January 19, 2026 05:01
@tgxworld tgxworld merged commit dc01d03 into main Jan 19, 2026
5 checks passed
@tgxworld tgxworld deleted the fix-tag-object-compatibility branch January 19, 2026 05:16
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.

2 participants