Skip to content

Commit 6a485e9

Browse files
committed
frontend: ensure the website title is correctly set
1 parent f1109d1 commit 6a485e9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

frontend/src/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ const Frame = lazy(() => import('./pages/Frame.js').then(m => m.Frame));
7777
export function App() {
7878
const {t} = useTranslation("", {useSuspense: false});
7979

80+
useEffect(() => {
81+
if (!connected.value) {
82+
document.title = t("app_name");
83+
}
84+
}, [connected.value, t]);
85+
8086
useEffect(() => {
8187
refresh_access_token();
8288
})
@@ -144,6 +150,8 @@ export function App() {
144150
<LocationProvider>
145151
<Router onRouteChange={() => {
146152
connected.value = false;
153+
// Ensure title is reset to translated app name when navigating away from a device connection
154+
document.title = t("app_name");
147155
}}>
148156
<Route path="/tokens" component={Tokens} />
149157
<Route path="/user" component={User} />

frontend/src/pages/Frame.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ export class Frame extends Component<{}, FrameState> {
273273
if (this.interface && this.interface.cancel) {
274274
this.interface.cancel();
275275
}
276+
document.title = i18n.t("app_name");
277+
connected.value = false;
276278
}
277279

278280
render() {

0 commit comments

Comments
 (0)