From 06d318820a8413b147e0f793124c436ad434c7f3 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 15 Jan 2021 13:48:01 -0500 Subject: [PATCH] FIX: TopicTrackingState was initialized after Site (#11732) --- .../pre-initializers/inject-discourse-objects.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/app/pre-initializers/inject-discourse-objects.js b/app/assets/javascripts/discourse/app/pre-initializers/inject-discourse-objects.js index a2c605c5452..37509ba78c9 100644 --- a/app/assets/javascripts/discourse/app/pre-initializers/inject-discourse-objects.js +++ b/app/assets/javascripts/discourse/app/pre-initializers/inject-discourse-objects.js @@ -45,19 +45,23 @@ export default { const currentUser = User.current(); app.register("current-user:main", currentUser, { instantiate: false }); app.currentUser = currentUser; + + ALL_TARGETS.forEach((t) => + app.inject(t, "topicTrackingState", "topic-tracking-state:main") + ); + const topicTrackingState = TopicTrackingState.create({ messageBus: MessageBus, siteSettings, currentUser, }); - - const site = Site.current(); - app.register("site:main", site, { instantiate: false }); - app.register("topic-tracking-state:main", topicTrackingState, { instantiate: false, }); + const site = Site.current(); + app.register("site:main", site, { instantiate: false }); + const session = Session.current(); app.register("session:main", session, { instantiate: false }); @@ -90,10 +94,6 @@ export default { app.inject(t, "siteSettings", "site-settings:main") ); - ALL_TARGETS.forEach((t) => - app.inject(t, "topicTrackingState", "topic-tracking-state:main") - ); - ALL_TARGETS.forEach((t) => app.inject(t, "site", "site:main")); ALL_TARGETS.forEach((t) =>