Skip to content

FEAT: improve conversation history loading for long sessions#371

Open
ivnnv wants to merge 2 commits intositeboon:mainfrom
ivnnv:improve-conversation-history-loading
Open

FEAT: improve conversation history loading for long sessions#371
ivnnv wants to merge 2 commits intositeboon:mainfrom
ivnnv:improve-conversation-history-loading

Conversation

@ivnnv
Copy link

@ivnnv ivnnv commented Feb 6, 2026

Fixes #386

Scrolling up through long conversations requires many "load more" cycles. This adds a "Load all messages" floating button that fetches the entire conversation history in one shot.

  • Floating overlay pill appears after each batch finishes loading, persists 2s
  • Shows loading spinner while fetching all messages
  • Shows green "All messages loaded" confirmation for 1s before disappearing
  • Preserves scroll position when bulk-loading (no viewport jump)
  • Ref-based guards prevent scroll handler from re-fetching after load-all
  • Performance warning shown; "Scroll to bottom" resets visible cap back to 100
  • Clean state reset on session switch
  • i18n keys for en, zh-CN, and ko

Updated to work with the new TypeScript component architecture from #374 (the big refactor). Changes are now across the modular hooks/views:

  • useChatSessionState.ts - core load-all logic, state, refs, timers
  • ChatInterface.tsx - prop wiring
  • ChatMessagesPane.tsx - floating overlay UI, performance warning banner

DEMO:

feat-load-all-messages.mov

Note: default page size (20) and visible cap (100) are unchanged. These could be increased in a follow-up or made configurable via settings.

Summary by CodeRabbit

  • New Features
    • Added new in-app messages for loading all chat messages in a session
    • Includes a performance notification to alert users when large message volumes may impact scrolling speed
    • Messages now available in English and Simplified Chinese

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This pull request adds four new localization keys for a "load all messages" feature across English and Chinese locale files. The additions include messages for loading all messages, a loading indicator, completion notification, and a performance warning for large message sets.

Changes

Cohort / File(s) Summary
Localization for load all messages feature
src/i18n/locales/en/chat.json, src/i18n/locales/zh-CN/chat.json
Added four new message keys: loadAll, loadingAll, allLoaded, and perfWarning with corresponding English and Chinese translations to support loading entire conversation history in a single action.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested reviewers

  • viper151

Poem

🐰 Hops of joy, the messages now load,
No more scrolling down this long road,
All at once, the history unfolds,
A rabbit's dream in translations bold! 🌙✨

🚥 Pre-merge checks | ✅ 5 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR adds localization keys for the load-all feature mentioned in issue #386 but the raw summary shows only i18n changes without showing the functional implementation across the mentioned files. Verify that the functional changes in useChatSessionState.ts, ChatInterface.tsx, and ChatMessagesPane.tsx are present in the complete PR to fully address issue #386's requirement for a load-all feature.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main objective: improving conversation history loading for long sessions by adding a load-all feature.
Out of Scope Changes check ✅ Passed All changes are localization key additions directly supporting the load-all feature described in issue #386; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@ivnnv ivnnv force-pushed the improve-conversation-history-loading branch 3 times, most recently from b1bd8fb to c3ce3fc Compare February 6, 2026 17:58
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/components/ChatInterface.jsx`:
- Around line 4390-4469: When starting loadAllMessages, capture a session-bound
identifier (e.g., const currentSessionId = selectedSession?.id and
currentSessionProvider = sessionProvider) and before applying any state updates
or clearing flags (setSessionMessages, setHasMoreMessages, setTotalMessages,
setMessagesOffset, setVisibleMessageCount, setAllMessagesLoaded,
setLoadAllJustFinished, setShowLoadAllOverlay, and refs like
allMessagesLoadedRef/current and isLoadingMoreRef) verify the captured
id/provider still matches selectedSession/id and sessionProvider; if it doesn't,
abort/return early and do not mutate state. Optionally implement an
AbortController tied to the request and call abort when selectedSession changes,
but at minimum add the session-id check before the response handling, catch
block, and finally block so late responses cannot overwrite a newly selected
session.

@ivnnv ivnnv force-pushed the improve-conversation-history-loading branch from c3ce3fc to 2fe0f0c Compare February 6, 2026 18:09
Scrolling up through long conversations requires many "load more" cycles.
This adds a "Load all messages" floating button that fetches the entire
conversation history in one shot.

- Floating overlay pill appears after each batch finishes loading, persists 2s
- Shows loading spinner while fetching all messages
- Shows green "All messages loaded" confirmation for 1s before disappearing
- Preserves scroll position when bulk-loading (no viewport jump)
- Ref-based guards prevent scroll handler from re-fetching after load-all
- Performance warning shown; "Scroll to bottom" resets visible cap
- Clean state reset on session switch
- i18n keys for en and zh-CN

Note: default page size (20) and visible cap (100) are unchanged.
These could be increased in a follow-up or made configurable via settings.
@ivnnv
Copy link
Author

ivnnv commented Feb 14, 2026

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ivnnv ivnnv force-pushed the improve-conversation-history-loading branch from f7a7eb9 to 947d931 Compare February 14, 2026 20:09
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.

Long conversations require excessive scrolling to load full history

1 participant