Skip to content

fix: plan content view losing scroll position on unmount#1307

Merged
jonathanlab merged 2 commits intoPostHog:mainfrom
CaioDGallo:fix/scroll-position-lost-on-unmount
Mar 31, 2026
Merged

fix: plan content view losing scroll position on unmount#1307
jonathanlab merged 2 commits intoPostHog:mainfrom
CaioDGallo:fix/scroll-position-lost-on-unmount

Conversation

@CaioDGallo
Copy link
Copy Markdown
Contributor

@CaioDGallo CaioDGallo commented Mar 20, 2026

Problem

  • The plan content view in the conversation loses its scroll position when unmounted (e.g. scrolling until it leaves the screen).
  • If there is a big plan, it can be annoying for the user to keep coming back to the plan and having to scroll back to where they were previously reading.

Changes

  • Added a JavaScript Map for storing previous scroll positions of any PlanContent.tsx component present in the current conversation.
  • Scroll now keeps its position even when multiple Plan iterations exist in the conversation history.

Closes #1298

@CaioDGallo CaioDGallo force-pushed the fix/scroll-position-lost-on-unmount branch from a97f8da to f1c2b84 Compare March 29, 2026 11:18
Copy link
Copy Markdown
Contributor

@jonathanlab jonathanlab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

small nit: This also occurs with any other scrollable elements in the chat, such as diffs, but we can fix that in another PR.

@jonathanlab jonathanlab enabled auto-merge (squash) March 31, 2026 09:24
@jonathanlab jonathanlab merged commit fba8bef into PostHog:main Mar 31, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scroll position does not persist on unmounted components in the virtualized list

2 participants