From d1d3c9a68bdea092fc099515a6111a4fb7284aaa Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 22 Jan 2020 16:50:46 +1100 Subject: [PATCH] do not call MainHeader.render() in render of leftpane sections --- stylesheets/_session.scss | 1 - ts/components/session/LeftPaneChannelSection.tsx | 8 +++++++- ts/components/session/LeftPaneContactSection.tsx | 8 +++++++- ts/components/session/LeftPaneMessageSection.tsx | 10 ++++++++-- ts/components/session/LeftPaneSettingSection.tsx | 8 +++++++- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss index 01ac68502..8b1fdf7b6 100644 --- a/stylesheets/_session.scss +++ b/stylesheets/_session.scss @@ -1272,7 +1272,6 @@ label { background-color: $session-color-white; border-color: $session-color-white; } - } .user-details-dialog { .session-id-editable { diff --git a/ts/components/session/LeftPaneChannelSection.tsx b/ts/components/session/LeftPaneChannelSection.tsx index c9e2a1802..9905cde9d 100644 --- a/ts/components/session/LeftPaneChannelSection.tsx +++ b/ts/components/session/LeftPaneChannelSection.tsx @@ -170,9 +170,15 @@ export class LeftPaneChannelSection extends React.Component { return LeftPane.RENDER_HEADER(labels, null); } - public render(): JSX.Element { + public componentDidMount() { + MainViewController.renderMessageView(); + } + + public componentDidUpdate() { MainViewController.renderMessageView(); + } + public render(): JSX.Element { return (
{this.renderHeader()} diff --git a/ts/components/session/LeftPaneContactSection.tsx b/ts/components/session/LeftPaneContactSection.tsx index 273145208..a8e993adb 100644 --- a/ts/components/session/LeftPaneContactSection.tsx +++ b/ts/components/session/LeftPaneContactSection.tsx @@ -94,9 +94,15 @@ export class LeftPaneContactSection extends React.Component { ); } - public render(): JSX.Element { + public componentDidMount() { + MainViewController.renderMessageView(); + } + + public componentDidUpdate() { MainViewController.renderMessageView(); + } + public render(): JSX.Element { return (
{this.renderHeader()} diff --git a/ts/components/session/LeftPaneMessageSection.tsx b/ts/components/session/LeftPaneMessageSection.tsx index 8aaf180d9..85e30d0a5 100644 --- a/ts/components/session/LeftPaneMessageSection.tsx +++ b/ts/components/session/LeftPaneMessageSection.tsx @@ -145,6 +145,14 @@ export class LeftPaneMessageSection extends React.Component { return [list]; } + public componentDidMount() { + MainViewController.renderMessageView(); + } + + public componentDidUpdate() { + MainViewController.renderMessageView(); + } + public renderHeader(): JSX.Element { const labels = [window.i18n('messagesHeader')]; @@ -157,8 +165,6 @@ export class LeftPaneMessageSection extends React.Component { } public render(): JSX.Element { - MainViewController.renderMessageView(); - return (
{this.renderHeader()} diff --git a/ts/components/session/LeftPaneSettingSection.tsx b/ts/components/session/LeftPaneSettingSection.tsx index 0e07c9285..9270d3ff4 100644 --- a/ts/components/session/LeftPaneSettingSection.tsx +++ b/ts/components/session/LeftPaneSettingSection.tsx @@ -33,9 +33,15 @@ export class LeftPaneSettingSection extends React.Component { this.renderRows = this.renderRows.bind(this); } - public render(): JSX.Element { + public componentDidMount() { + MainViewController.renderSettingsView(this.state.settingCategory); + } + + public componentDidUpdate() { MainViewController.renderSettingsView(this.state.settingCategory); + } + public render(): JSX.Element { return (
{this.renderHeader()}