Skip to content

Commit f6f2bb8

Browse files
authored
Key the feed scroller by channel so revisits land at the latest message
Channel-to-channel navigation swaps the feed content without a route remount, so the scroller provider persisted and its one-shot defaultScrollPosition never re-applied — a revisited channel kept the previous channel's scroll offset (often the top). Keying the provider by channelId fresh-mounts it per channel, re-firing the initial end-scroll. Generated-By: PostHog Code Task-Id: d887d524-7d87-4d7a-b38c-b20289937ad1
1 parent a0a78f7 commit f6f2bb8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/ui/src/features/canvas/components/ChannelFeedView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,11 @@ export function ChannelFeedView({
716716
const latestPendingId = pending[pending.length - 1]?.id;
717717

718718
return (
719-
<ChatMessageScrollerProvider defaultScrollPosition="end">
719+
// Keyed by channel: switching channels swaps the content without a route
720+
// remount, but the scroller only applies defaultScrollPosition once per
721+
// mount — an un-keyed provider would keep the previous channel's scroll
722+
// offset instead of landing at the latest message.
723+
<ChatMessageScrollerProvider key={channelId} defaultScrollPosition="end">
720724
<FollowOwnPost latestPendingId={latestPendingId} />
721725
<ChatMessageScroller className="min-h-0 flex-1">
722726
<ChatMessageScrollerViewport>

0 commit comments

Comments
 (0)