From 9e70884a16703e4b5c2f92ebbefdf97e6e614d6e Mon Sep 17 00:00:00 2001 From: hobokenchicken Date: Thu, 2 Jul 2026 13:59:27 -0400 Subject: [PATCH] fix: use ChannelStore for activeChannelId subscription activeChannelId lives on ChannelStore, not ServerStore. --- web/src/components/Layout.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/src/components/Layout.tsx b/web/src/components/Layout.tsx index a050d2a..8b290f5 100644 --- a/web/src/components/Layout.tsx +++ b/web/src/components/Layout.tsx @@ -3,6 +3,7 @@ import { Link, Outlet, useLocation, useNavigate } from 'react-router-dom'; import { useAuthStore, type UserStatus } from '../stores/auth.ts'; import { useWebSocketStore } from '../stores/ws.ts'; import { useServerStore } from '../stores/server.ts'; +import { useChannelStore } from '../stores/channel.ts'; import { useLayoutStore } from '../stores/layout.ts'; import { ServerBar } from './ServerBar.tsx'; import { ChannelList } from './ChannelList.tsx'; @@ -42,7 +43,7 @@ export function Layout() { const setMobileView = useLayoutStore((s) => s.setMobileView); const [showServerSettings, setShowServerSettings] = useState(false); const activeServerId = useServerStore((s) => s.activeServerId); - const activeChannelId = useServerStore((s) => s.activeChannelId); + const activeChannelId = useChannelStore((s) => s.activeChannelId); useEffect(() => { wsConnect(); return () => { wsDisconnect(); }; @@ -54,7 +55,7 @@ export function Layout() { }, [isLoading, isAuthenticated, location.pathname, navigate]); // Navigate to chat when a channel/DM is selected on mobile useEffect(() => { - const unsub = useServerStore.subscribe((state, prev) => { + const unsub = useChannelStore.subscribe((state, prev) => { if (state.activeChannelId !== prev.activeChannelId && state.activeChannelId) { setMobileView('chat'); }