Skip to content

fix: preserve scroll position when loading older messages#178

Merged
yongkangc merged 1 commit into
cfal:mainfrom
0xSolarPunk:codex/fix-pr176-scroll-jump
Jun 1, 2026
Merged

fix: preserve scroll position when loading older messages#178
yongkangc merged 1 commit into
cfal:mainfrom
0xSolarPunk:codex/fix-pr176-scroll-jump

Conversation

@0xSolarPunk
Copy link
Copy Markdown
Contributor

@0xSolarPunk 0xSolarPunk commented May 30, 2026

Summary

  • stop the chat mount autoscroll effect from retriggering when older messages are prepended
  • preserve the viewport anchor after load-more waits for Svelte to flush rendered messages
  • guard anchor restoration if the user switches chats while older messages are still loading
  • add regression coverage for anchor preservation and stale chat-switch behavior

Review fix

  • Rebased onto current cfal/garcon main.
  • Added a selected-chat guard around the async anchor restore path so a completed older-message load cannot mutate the next chat's scroll position after navigation.

Validation

  • bun run --cwd web test -- src/lib/chat/tests/conversation-scroll-controller.test.ts src/lib/chat/tests/conversation-feed-items.test.ts
  • bun run --cwd web i18n:compile
  • bun run check
  • bun run test
  • timeout 30s bun run start --port 0

@0xSolarPunk 0xSolarPunk force-pushed the codex/fix-pr176-scroll-jump branch from 5dcaba5 to f00c1a9 Compare May 30, 2026 05:32
@0xSolarPunk 0xSolarPunk changed the base branch from codex/pr176-scroll-fix-base to main May 30, 2026 05:32
@0xSolarPunk 0xSolarPunk force-pushed the codex/fix-pr176-scroll-jump branch from f00c1a9 to e0b3b1d Compare May 30, 2026 10:30
@0xSolarPunk
Copy link
Copy Markdown
Contributor Author

@codex review

@yongkangc yongkangc merged commit a5f68db into cfal:main Jun 1, 2026
4 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.

2 participants