FIX: TopicTrackingState was initialized after Site (#11732)

This commit is contained in:
Robin Ward 2021-01-15 13:48:01 -05:00 committed by GitHub
parent f772a0beac
commit 06d318820a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,19 +45,23 @@ export default {
const currentUser = User.current(); const currentUser = User.current();
app.register("current-user:main", currentUser, { instantiate: false }); app.register("current-user:main", currentUser, { instantiate: false });
app.currentUser = currentUser; app.currentUser = currentUser;
ALL_TARGETS.forEach((t) =>
app.inject(t, "topicTrackingState", "topic-tracking-state:main")
);
const topicTrackingState = TopicTrackingState.create({ const topicTrackingState = TopicTrackingState.create({
messageBus: MessageBus, messageBus: MessageBus,
siteSettings, siteSettings,
currentUser, currentUser,
}); });
const site = Site.current();
app.register("site:main", site, { instantiate: false });
app.register("topic-tracking-state:main", topicTrackingState, { app.register("topic-tracking-state:main", topicTrackingState, {
instantiate: false, instantiate: false,
}); });
const site = Site.current();
app.register("site:main", site, { instantiate: false });
const session = Session.current(); const session = Session.current();
app.register("session:main", session, { instantiate: false }); app.register("session:main", session, { instantiate: false });
@ -90,10 +94,6 @@ export default {
app.inject(t, "siteSettings", "site-settings:main") 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) => app.inject(t, "site", "site:main"));
ALL_TARGETS.forEach((t) => ALL_TARGETS.forEach((t) =>