From 03bb43f7468d3aa6e73bba0805193ae50c7ec2d5 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 16 Dec 2024 19:19:42 +0000 Subject: [PATCH] DEV: Move topic-list-class transformer to getter (#30301) Using the (array) helper creates an array instance, passes it to applyValueTransformer, which then allows themes/plugins to mutate it. When the helper is re-computed, the **same array instance** is passed to the transformers again. Any elements added in the last run are still there. This commit moves applyValueTransformer to a getter, so that it's run with a brand new array each time. --- .../discourse/app/components/topic-list/list.gjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/topic-list/list.gjs b/app/assets/javascripts/discourse/app/components/topic-list/list.gjs index 549a18c4af2..99bccf33f8f 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list/list.gjs +++ b/app/assets/javascripts/discourse/app/components/topic-list/list.gjs @@ -1,6 +1,6 @@ import Component from "@glimmer/component"; import { cached } from "@glimmer/tracking"; -import { array, hash } from "@ember/helper"; +import { hash } from "@ember/helper"; import { service } from "@ember/service"; import { eq, or } from "truth-helpers"; import PluginOutlet from "discourse/components/plugin-outlet"; @@ -166,13 +166,19 @@ export default class TopicList extends Component { return lastVisitedTopic; } + get additionalClasses() { + return applyValueTransformer("topic-list-class", [], { + topics: this.args.topics, + }); + } +