From dea2d363f4fe1eebfc8e52ab10743dd496699174 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Tue, 17 Mar 2026 20:41:52 +0200 Subject: [PATCH] Don't auto-open chat unless we are on desktop --- app/features/chat/ChatProvider.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/features/chat/ChatProvider.tsx b/app/features/chat/ChatProvider.tsx index d9dec87ed..63f5993a8 100644 --- a/app/features/chat/ChatProvider.tsx +++ b/app/features/chat/ChatProvider.tsx @@ -7,6 +7,7 @@ import { useMatches, useRevalidator, } from "react-router"; +import { useLayoutSize } from "~/hooks/useMainContentWidth"; import { logger } from "~/utils/logger"; import { soundPath } from "~/utils/urls"; import type { @@ -557,6 +558,7 @@ function useChatRouteSync({ }) { const chatCode = useCurrentRouteChatCode(); const { pathname } = useLocation(); + const layoutSize = useLayoutSize(); const subscribedRoomRef = React.useRef(null); const previousRouteChatCodeRef = React.useRef(null); const previousPathnameRef = React.useRef(null); @@ -597,7 +599,9 @@ function useChatRouteSync({ if (routeChatCodeChanged) { setActiveRoom(chatCode); - setChatOpen(true); + if (layoutSize === "desktop") { + setChatOpen(true); + } } } else { previousRouteChatCodeRef.current = null; @@ -612,7 +616,9 @@ function useChatRouteSync({ if (matchedRoom) { setActiveRoom(matchedRoom.chatCode); - setChatOpen(true); + if (layoutSize === "desktop") { + setChatOpen(true); + } } } } @@ -625,6 +631,7 @@ function useChatRouteSync({ activeRoom, setActiveRoom, setChatOpen, + layoutSize, subscribe, unsubscribe, setRooms,