REFACTOR: Implement full page reloads for state-critical navigation

This commit is contained in:
Chris-1010
2025-02-22 13:00:20 +00:00
parent aa1b85513f
commit 12d9f3660a
9 changed files with 35 additions and 42 deletions

View File

@@ -5,7 +5,6 @@ import AuthModal from "../Auth/AuthModal";
import { useAuthModal } from "../../hooks/useAuthModal";
import { useAuth } from "../../context/AuthContext";
import { useSocket } from "../../context/SocketContext";
import { useNavigate } from "react-router-dom";
interface ChatMessage {
chatter_username: string;
@@ -28,7 +27,6 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
const [messages, setMessages] = useState<ChatMessage[]>([]);
const [inputMessage, setInputMessage] = useState("");
const chatContainerRef = useRef<HTMLDivElement>(null);
const navigate = useNavigate();
// Join chat room when component mounts
useEffect(() => {
@@ -147,7 +145,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
onClick={() =>
msg.chatter_username === username
? null
: navigate(`/user/${msg.chatter_username}`)
: window.location.href = `/user/${msg.chatter_username}`
}
>
<img
@@ -170,7 +168,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
onClick={() =>
msg.chatter_username === username
? null
: navigate(`/user/${msg.chatter_username}`)
: window.location.href = `/user/${msg.chatter_username}`
}
>
{msg.chatter_username}