From 13aed6fe3b027ba68ee7fefef7637c4e10dcd51b Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Sun, 28 Nov 2021 23:34:51 +0100 Subject: [PATCH] FIX: Setting bookmarks in some cases was broken (#15120) Error introduced in #14781 ``` Error: Assertion Failed: You attempted to update <(unknown):ember3217>.bookmarks to "<(unknown):ember3846>", but it is being tracked by a tracking context, such as a template, computed property, or observer. In order to make sure the context updates properly, you must invalidate the property when updating it. You can mark the property as `@tracked`, or use `@ember/object#set` to do this. ``` --- app/assets/javascripts/discourse/app/models/topic.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/models/topic.js b/app/assets/javascripts/discourse/app/models/topic.js index d5ed11eb76..bc0497d89e 100644 --- a/app/assets/javascripts/discourse/app/models/topic.js +++ b/app/assets/javascripts/discourse/app/models/topic.js @@ -493,7 +493,10 @@ const Topic = RestModel.extend({ keys.forEach((key) => this.set(key, json[key])); if (this.bookmarks.length) { - this.bookmarks = this.bookmarks.map((bm) => Bookmark.create(bm)); + this.set( + "bookmarks", + this.bookmarks.map((bm) => Bookmark.create(bm)) + ); } return this;