Skip to content

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

DEV: correctly teardown page changed event (#34383)

Joffrey JAFFEUXfc3ba98d0353
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/upcoming-events-list.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/upcoming-events-list.gjs
index 6eb7d6aac65..d0911f2cc31 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/upcoming-events-list.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/upcoming-events-list.gjs
@@ -47,6 +47,11 @@ export default class UpcomingEventsList extends Component {
this.appEvents.on("page:changed", this, this.updateEventsList);
}
+ willDestroy() {
+ super.willDestroy(...arguments);
+ this.appEvents.off("page:changed", this, this.updateEventsList);
+ }
+
get categoryId() {
return this.router.currentRoute.attributes?.category?.id;
}