Add logging to troubleshoot #2351
This commit is contained in:
parent
8890b564e8
commit
353e9c5896
@ -16,14 +16,20 @@ export const TitleNotifier: FC = () => {
|
|||||||
let backgrounded = false;
|
let backgrounded = false;
|
||||||
let defaultTitle = '';
|
let defaultTitle = '';
|
||||||
|
|
||||||
|
const setTitle = (title: string) => {
|
||||||
|
console.trace('Debug: Setting title to', title);
|
||||||
|
window.document.title = title;
|
||||||
|
};
|
||||||
|
|
||||||
const onBlur = () => {
|
const onBlur = () => {
|
||||||
|
console.log('onBlur: Saving defaultTitle as', window.document.title);
|
||||||
backgrounded = true;
|
backgrounded = true;
|
||||||
defaultTitle = window.document.title;
|
defaultTitle = window.document.title;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFocus = () => {
|
const onFocus = () => {
|
||||||
backgrounded = false;
|
backgrounded = false;
|
||||||
window.document.title = defaultTitle;
|
setTitle(defaultTitle);
|
||||||
};
|
};
|
||||||
|
|
||||||
const listenForEvents = () => {
|
const listenForEvents = () => {
|
||||||
@ -33,6 +39,8 @@ export const TitleNotifier: FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('useEffect: Saving defaultTitle as', window.document.title);
|
||||||
|
|
||||||
defaultTitle = window.document.title;
|
defaultTitle = window.document.title;
|
||||||
listenForEvents();
|
listenForEvents();
|
||||||
|
|
||||||
@ -48,8 +56,7 @@ export const TitleNotifier: FC = () => {
|
|||||||
if (!backgrounded || !online) {
|
if (!backgrounded || !online) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setTitle(`💬 :: ${defaultTitle}`);
|
||||||
window.document.title = `💬 :: ${defaultTitle}`;
|
|
||||||
}, [chatMessages]);
|
}, [chatMessages]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -60,9 +67,9 @@ export const TitleNotifier: FC = () => {
|
|||||||
const { online } = serverStatus;
|
const { online } = serverStatus;
|
||||||
|
|
||||||
if (online) {
|
if (online) {
|
||||||
window.document.title = ` 🟢 :: ${defaultTitle}`;
|
setTitle(` 🟢 :: ${defaultTitle}`);
|
||||||
} else if (!online) {
|
} else if (!online) {
|
||||||
window.document.title = ` 🔴 :: ${defaultTitle}`;
|
setTitle(` 🔴 :: ${defaultTitle}`);
|
||||||
}
|
}
|
||||||
}, [serverStatusState]);
|
}, [serverStatusState]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user