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 <resynth1943@tutanota.com>
pull/21833/head
resynth1943 2020-09-27 21:06:02 +01:00
parent 8ec7e7c714
commit 747f9fba38
1 changed files with 5 additions and 1 deletions

View File

@ -1843,7 +1843,11 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
} 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) {