Observer on "controller:edit-category.tabs" model not triggered

I was looking at your link, and the controller has been moved to /admin: discourse/app/assets/javascripts/admin/addon/controllers/edit-category/tabs.js at main · discourse/discourse · GitHub

I’m not sure why it doesn’t trigger. Maybe @observes doesn’t work well in modifyClass?

As an alternative, what do you think of:

@action
saveCategory(data) {
  const oldParentId = this.model.parent_category_id;
  super.saveCategory(data);
  const newParentId = this.model.parent_category_id;

  if (oldParentId !== newParentId) {
    console.log("Apply some logic here when parent category changes");
  }
}
2 Likes