Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion desktop/src/features/channels/ui/ChannelPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export const ChannelPane = React.memo(function ChannelPane({
useComposerHeightPadding(
timelineScrollRef,
composerWrapperRef,
`${isSinglePanelView}:${hasMainComposerOverlay}`,
`${activeChannelId}:${isSinglePanelView}:${hasMainComposerOverlay}`,
);

const clearWelcomeComposerDismissTimer = React.useCallback(() => {
Expand Down
7 changes: 7 additions & 0 deletions desktop/src/features/messages/ui/MessageTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ const MessageTimelineBase = React.forwardRef<
const scrollRestorationId = targetMessageId
? `message-timeline:${channelId ?? "none"}:target:${targetMessageId}`
: `message-timeline:${channelId ?? "none"}`;
// Keep the scroll node's DOM lifetime scoped to a channel. TanStack Router's
// scroll-restoration listener runs outside React and may write a saved
// scrollTop into the current scroll element during navigation; reusing the
// same node across channel routes can leave the newly-loaded message list
// painted at a stale offset until the user's next scroll event forces layout.
const scrollContainerDomKey = channelId ?? "none";

const timelineBodySurface = selectTimelineBodySurface({
deferredCount: deferredMessages.length,
Expand Down Expand Up @@ -339,6 +345,7 @@ const MessageTimelineBase = React.forwardRef<
)}
data-scroll-restoration-id={scrollRestorationId}
data-testid="message-timeline"
key={scrollContainerDomKey}
onScroll={onScroll}
ref={scrollContainerRef}
>
Expand Down