Skip to content

Virtualize Log component with scrollback limits and infinite scroll#1

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1779400205-virtualize-log-component
Open

Virtualize Log component with scrollback limits and infinite scroll#1
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1779400205-virtualize-log-component

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Virtualizes the React Log component by configuring xterm.js with a bounded scrollback buffer (5000 lines) and adding infinite scroll behavior to fetch older logs from Redis when the user scrolls to the top.

Changes:

  • Set scrollback: 5000 on xterm to cap DOM/memory usage regardless of stream length
  • Added scroll-to-top detection via xterm's onScroll callback to trigger paginated fetches from Redis (askRange with FETCH_BATCH_SIZE = 200)
  • Track earliest stream ID via ref for proper pagination
  • Added proper socket cleanup on component unmount (disconnect(), off())
  • Removed unused Line import and response state array
  • Memoized callbacks with useCallback to prevent unnecessary re-renders

Review & Testing Checklist for Human

  • Start all services (Redis, Go server, Node socket server, React dev server) and pipe a large stream (e.g., ./app/runner.sh | ./app/app) to verify the xterm scrollback limit caps at 5000 lines
  • Verify scrolling to top triggers loading older log lines from Redis
  • Confirm new live-streamed lines still appear at the bottom in real-time

Notes

  • xterm.js already virtualizes DOM rendering (only renders visible rows). This change adds the scrollback limit and infinite scroll to make the overall system properly virtualized end-to-end.
  • NODE_OPTIONS=--openssl-legacy-provider is required when building with Node 22 + react-scripts 4.x.

Virtualization working

Link to Devin session: https://app.devin.ai/sessions/62e7884e8d894e378e8df86605f9c1bd
Requested by: @braeden

- Set xterm scrollback buffer limit to 5000 lines to cap memory usage
- Add scroll-to-top detection to fetch older logs from Redis in batches of 200
- Track earliest stream ID for pagination via refs
- Add proper socket cleanup on unmount
- Remove unused Line import and response state
- Memoize callbacks with useCallback to prevent unnecessary re-renders

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

1 participant