in src/views/article/article.tsx [99:137]
componentDidMount() {
logEvent({
message: 'Navigate to article',
analyticsId: ANALYTICS_ARTICLE_PAGE,
});
this.goOnlineSubscription = addListenerGoOnline(() => {
this.loadArticle(currentArticle.id, false);
});
if (this.props.storePrevArticle) {
this.props.setPreviousArticle();
}
this.props.resetArticleCommentDraft();
const currentArticle: ArticleEntity = this.getArticle();
const canLoadArticle: boolean = !!currentArticle && !!(currentArticle.id || currentArticle.idReadable);
if (canLoadArticle) {
this.switchToDetailsTab();
this.props.loadArticleFromCache(currentArticle);
this.loadArticle(currentArticle.id || currentArticle.idReadable, false);
this.unsubscribe = Router.setOnDispatchCallback(
(routeName: string, prevRouteName: string) => {
if (
routeName === routeMap.ArticleSingle &&
prevRouteName === routeMap.ArticleCreate
) {
this.loadArticle(currentArticle.id, false);
}
},
);
}
if (canLoadArticle && (this.props.navigateToActivity || this.props.commentId)) {
this.switchToActivityTab();
} else if (!canLoadArticle && !this.props.navigateToActivity && !this.props.commentId) {
return Router.KnowledgeBase();
}
}