From cd4e0ab3c2cfd615e4771fb9181a31ce237b5ceb Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 8 Jul 2020 01:02:14 -0400 Subject: HTML title bugs. - Fixing HTML titles for some pages. Fixes #801 - Removing WebSocketService.Instance.site, fetching site on demand now. --- ui/src/components/communities.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'ui/src/components/communities.tsx') diff --git a/ui/src/components/communities.tsx b/ui/src/components/communities.tsx index a3e340ff..441f7bb1 100644 --- a/ui/src/components/communities.tsx +++ b/ui/src/components/communities.tsx @@ -1,5 +1,4 @@ import { Component, linkEvent } from 'inferno'; -import { Link } from 'inferno-router'; import { Subscription } from 'rxjs'; import { retryWhen, delay, take } from 'rxjs/operators'; import { @@ -11,6 +10,7 @@ import { ListCommunitiesForm, SortType, WebSocketJsonResponse, + GetSiteResponse, } from '../interfaces'; import { WebSocketService } from '../services'; import { wsJsonToRes, toast } from '../utils'; @@ -47,6 +47,7 @@ export class Communities extends Component { ); this.refetch(); + WebSocketService.Instance.getSite(); } getPageFromProps(props: any): number { @@ -57,12 +58,6 @@ export class Communities extends Component { this.subscription.unsubscribe(); } - componentDidMount() { - document.title = `${i18n.t('communities')} - ${ - WebSocketService.Instance.site.name - }`; - } - // Necessary for back button for some reason componentWillReceiveProps(nextProps: any) { if (nextProps.history.action == 'POP') { @@ -244,6 +239,9 @@ export class Communities extends Component { found.subscribed = data.community.subscribed; found.number_of_subscribers = data.community.number_of_subscribers; this.setState(this.state); + } else if (res.op == UserOperation.GetSite) { + let data = res.data as GetSiteResponse; + document.title = `${i18n.t('communities')} - ${data.site.name}`; } } } -- cgit v1.2.3