diff --git a/apps/desktop/src/pages/ConversationPage.tsx b/apps/desktop/src/pages/ConversationPage.tsx index d486b5d..b3c151b 100644 --- a/apps/desktop/src/pages/ConversationPage.tsx +++ b/apps/desktop/src/pages/ConversationPage.tsx @@ -94,18 +94,18 @@ type VirtuosoRow = // change on every parent render. const EMPTY_REACTIONS: AggregatedReaction[] = []; -// Per-conversation scroll memory. Module-scoped so it survives re-mounts -// of ConversationPage when the route param (`id`) changes — switching -// chats unmounts/remounts the page in our router setup. Session-only -// (lost on reload, like Discord). The `stickToBottom` flag is preserved -// alongside the topmost-visible row index so a chat the user left at the -// bottom keeps auto-following new messages when they return; a chat -// scrolled up returns to roughly the same row the user was reading. +// Per-conversation scroll memory. Module-scoped so it survives the +// per-id remount of ConversationPage (see `ConversationRoute` in +// App.tsx). Session-only (lost on reload, like Discord). The +// `stickToBottom` flag is preserved alongside the topmost-visible row +// index so a chat the user left at the bottom keeps auto-following new +// messages when they return; a chat scrolled up returns to roughly the +// same row the user was reading. // // We track the topmost-visible row index rather than a pixel `scrollTop` // because `react-virtuoso` virtualizes the list — the underlying scroll // element's pixel offset depends on dynamically-measured row heights and -// is not stable across re-mounts. Using a row index restores the user's +// is not stable across remounts. Using a row index restores the user's // reading position even if some rows above re-render at different heights. const scrollPositions = new Map(); @@ -304,20 +304,6 @@ export function ConversationPage() { const fileInputRef = useRef(null); const composerRef = useRef(null); - useEffect(() => { - setReplyTo(null); - setForwardTarget(null); - setSearchOpen(false); - setMediaDrawerOpen(false); - setPollDialogOpen(false); - setSearchQuery(''); - setDisplayCount(150); - setFirstUnreadId(null); - setFirstUnreadJumpDismissed(false); - setNewMessagesWhileAway(0); - previousMessageIdsRef.current = new Set(); - firstUnreadComputedRef.current = false; - }, [id]); useEffect(() => { if (firstUnreadComputedRef.current) return;