fix(app): restore history loading after session switch - #34185
Conversation
When switching back to a session whose message cache was evicted, only 2 messages were loaded (initialMessagePageSize). If those filled the viewport, fill() would bail out and never trigger loadOlder(), leaving the user stuck with no visible history. Two fixes: fill() no longer skips loadOlder when message count is <= 2, even if the viewport is full. Added a scroll-to-top listener that triggers loadOlder when the user scrolls near the top (scrollTop < 200px), matching the existing onHistoryScroll continuation threshold.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
When switching back to a session whose message cache was evicted, only 2 messages were loaded (initialMessagePageSize). If those filled the viewport, fill() would bail out and never trigger loadOlder(), leaving the user stuck with no visible history.
Two fixes: fill() no longer skips loadOlder when message count is <= 2, even if the viewport is full. Added a scroll-to-top listener that triggers loadOlder when the user scrolls near the top (scrollTop < 200px), matching the existing onHistoryScroll continuation threshold.
Issue for this PR
Closes #34187
Type of change
What does this PR do?
Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
I thought an expected behaviour and unittested it
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.