Fix title being empty

This commit is contained in:
qvalentin 2023-01-10 19:09:24 +01:00
parent e7fd95e2cd
commit 3690de9fe0
2 changed files with 11 additions and 6 deletions

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title> <title>FF Jitsi Rooms</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>

View File

@ -11,10 +11,13 @@ function useRoomName() {
[setRoomName] [setRoomName]
); );
const submitRoomName = useCallback(() => { const submitRoomName = useCallback(
setRoomNameInUrl(roomName); () => {
setRoomNameInTitle(roomName); setRoomNameInUrl(roomName);
}, [roomName]); setRoomNameInTitle(roomName);
},
[roomName]
);
return { roomName, updateRoomName, submitRoomName }; return { roomName, updateRoomName, submitRoomName };
} }
@ -34,7 +37,9 @@ function setRoomNameInUrl(roomName: string) {
} }
function setRoomNameInTitle(roomName: string) { function setRoomNameInTitle(roomName: string) {
document.title = roomName; if (!!roomName) {
document.title = roomName;
}
} }
export { useRoomName }; export { useRoomName };