Skip to content

A platform for community discussion. Free, open, simple.

FIX: Trigger reactions re-render with a new array reference (#39226)

Mark VanLandinghamf6a1e7c11b85
diff --git a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-actions.gjs b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-actions.gjs
index bdb3f060f25..4486aa1ac3d 100644
--- a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-actions.gjs
+++ b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-actions.gjs
@@ -467,8 +467,9 @@ export default class DiscourseReactionsActions extends Component {
}
// Trigger re-render for anything autotracking reactions.
// In future, we should make reactions a deeply-trackable structure.
- // eslint-disable-next-line no-self-assign
- this.data.reactions = this.data.reactions;
+ // A new array reference is required because Ember's native trackedObject
+ // skips dirtying when Object.is(oldValue, newValue) is true.
+ this.data.reactions = [...this.data.reactions];
}
@action