Skip to content

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

FIX: Tag group form not updating when switching between tag groups (#38372)

Sérgio Saquetimf5a4e085553e
diff --git a/frontend/discourse/app/components/tag-groups-form.gjs b/frontend/discourse/app/components/tag-groups-form.gjs
index b0c8402388f..68eebdb0060 100644
--- a/frontend/discourse/app/components/tag-groups-form.gjs
+++ b/frontend/discourse/app/components/tag-groups-form.gjs
@@ -1,9 +1,7 @@
/* eslint-disable ember/no-classic-components */
-import { cached } from "@glimmer/tracking";
import Component, { Input } from "@ember/component";
import { hash } from "@ember/helper";
import { action, computed } from "@ember/object";
-import { dependentKeyCompat } from "@ember/object/compat";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
@@ -28,8 +26,7 @@ export default class TagGroupsForm extends Component {
({ id }) => id !== AUTO_GROUPS.everyone.id
);
- @cached
- @dependentKeyCompat
+ @computed("model")
get buffered() {
return BufferedProxy.create({
content: this.model,
diff --git a/spec/system/page_objects/pages/admin_tag_groups.rb b/spec/system/page_objects/pages/admin_tag_groups.rb
index 0d42cd7b851..1e0cdf57fa9 100644
--- a/spec/system/page_objects/pages/admin_tag_groups.rb
+++ b/spec/system/page_objects/pages/admin_tag_groups.rb
@@ -34,6 +34,10 @@ module PageObjects
)
end
+ def has_name?(name)
+ find(".group-name input").value == name
+ end
+
def has_tag_in_group?(tag_name)
has_css?(".group-tags-list .tag-chooser", text: tag_name)
end
diff --git a/spec/system/tag_group_spec.rb b/spec/system/tag_group_spec.rb
index 152d8994c8b..c4d9eb580f4 100644
--- a/spec/system/tag_group_spec.rb
+++ b/spec/system/tag_group_spec.rb
@@ -34,6 +34,28 @@ describe "Tag Groups", type: :system do
end
end
+ describe "navigating between tag groups" do
+ fab!(:tag3) { Fabricate(:tag, name: "rats") }
+ fab!(:group_one) { Fabricate(:tag_group, name: "Group One", tags: [tag1]) }
+ fab!(:group_two) { Fabricate(:tag_group, name: "Group Two", tags: [tag2, tag3]) }
+
+ it "updates the form when clicking a different tag group in the sidebar" do
+ tag_groups_page.visit
+ tag_groups_page.click_tag_group("Group One")
+
+ expect(tag_groups_page).to have_name("Group One")
+ expect(tag_groups_page).to have_tag_in_group("cats")
+ expect(tag_groups_page).to have_no_tag_in_group("bats")
+
+ tag_groups_page.click_tag_group("Group Two")
+
+ expect(tag_groups_page).to have_name("Group Two")
+ expect(tag_groups_page).to have_tag_in_group("bats")
+ expect(tag_groups_page).to have_tag_in_group("rats")
+ expect(tag_groups_page).to have_no_tag_in_group("cats")
+ end
+ end
+
describe "creating a new tag group" do
fab!(:existing_tag_group) { Fabricate(:tag_group, name: "Existing Group") }