Skip to content

Commit

Permalink
Merge pull request #2969 from bodrych/window-title-chat-fix
Browse files Browse the repository at this point in the history
Change window title to Chat on ChatView mount
  • Loading branch information
anoek authored Feb 24, 2025
2 parents e1c0b84 + bdc8f49 commit 983a574
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/views/ChatView/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as data from "@/lib/data";
import { useState, useEffect, useCallback } from "react";
import { ChatChannelList, ChatLog, ChatUsersList } from "@/components/Chat";
import { useParams } from "react-router";
import { _ } from "@/lib/translate";

export function ChatView(): React.ReactElement | null {
const { channel } = useParams();
Expand All @@ -33,6 +34,14 @@ export function ChatView(): React.ReactElement | null {
false as boolean,
);

useEffect(() => {
const oldTitle = window.document.title;
window.document.title = _("Chat");
return () => {
window.document.title = oldTitle;
};
}, [channel]);

useEffect(() => {
set_showing_channels(false);
set_showing_users(false);
Expand Down

0 comments on commit 983a574

Please sign in to comment.