From 747f9fba387826404e54dfdd450e430806e42261 Mon Sep 17 00:00:00 2001 From: resynth1943 Date: Sun, 27 Sep 2020 21:06:02 +0100 Subject: [PATCH 1/2] Only set title when it changes I've seen Chromium constantly refresh the title in the developer tools. To be honest, I'm not sure if this means Chromium wastes CPU time changing a title, but this may introduce better performance. Signed-off-by: Resynth --- src/components/structures/MatrixChat.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index ea1f424af6..122abad438 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -1843,7 +1843,11 @@ export default class MatrixChat extends React.PureComponent { } else { subtitle = `${this.subTitleStatus} ${subtitle}`; } - document.title = `${SdkConfig.get().brand} ${subtitle}`; + const title = `${SdkConfig.get().brand} ${subtitle}`; + + if (document.title !== title) { + document.title = title; + } } updateStatusIndicator(state: string, prevState: string) { From b499fd06fc8653cc3b1589d242784b4a24fb3721 Mon Sep 17 00:00:00 2001 From: resynth1943 Date: Sun, 27 Sep 2020 21:20:41 +0100 Subject: [PATCH 2/2] Formatting change --- src/components/structures/MatrixChat.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 122abad438..a7c1b9cbcb 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -1843,6 +1843,7 @@ export default class MatrixChat extends React.PureComponent { } else { subtitle = `${this.subTitleStatus} ${subtitle}`; } + const title = `${SdkConfig.get().brand} ${subtitle}`; if (document.title !== title) {