Skip to content
This repository was archived by the owner on Sep 16, 2026. It is now read-only.

fix: completely disable virtualization to fix React errors #418/#185 - #435

Merged
leoisadev1 merged 1 commit into
mainfrom
fix/disable-virtualization
Nov 27, 2025
Merged

leoisadev1 merged 1 commit into
mainfrom
fix/disable-virtualization

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

Summary

  • EMERGENCY FIX: Completely disable @tanstack/react-virtual virtualization
  • PR fix: React 19 virtualizer optimization workaround #434's virtualizerRef workaround was insufficient - errors still occur
  • The error happens INSIDE the library code during React 19 hydration, not in our wrapper
  • This sets shouldVirtualize = false to force all messages to use the non-virtualized render path

Root Cause Analysis

The @tanstack/react-virtual library has known compatibility issues with React 19:

The previous fixes (PRs #431, #432, #433, #434) attempted workarounds but the error persists because it originates INSIDE the library's internal code, not in our component wrapper.

Trade-off

Test plan

  • Reload page during streaming - no React errors should appear
  • Chat with 50+ messages loads correctly
  • Scrolling works smoothly

🤖 Generated with Claude Code

EMERGENCY FIX: The @tanstack/react-virtual library causes infinite re-render
loops during hydration in React 19, even with the virtualizerRef workaround
from PR #434. The error occurs INSIDE the library code, not in our wrapper.

This completely disables virtualization until @tanstack/react-virtual
officially supports React 19.

References:
- TanStack/virtual#743
- TanStack/virtual#924

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@vercel

vercel Bot commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
openchat-web Building Building Preview Comment Nov 27, 2025 0:27am

@leoisadev1
leoisadev1 merged commit 430e4ef into main Nov 27, 2025
@greptile-apps

greptile-apps Bot commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Disables @tanstack/react-virtual virtualization by hardcoding shouldVirtualize = false to fix React 19 hydration errors (#418) and infinite re-render loops (#185).

Key Changes

  • Changed shouldVirtualize from isMounted && messages.length > 20 to false (line 132)
  • All messages now render at once (non-virtualized path)
  • Previous workarounds (virtualizerRef, stable callbacks) proved insufficient

Issues Found

  • Dead code: Lines 133-171 create a virtualizer, refs, and callbacks that are never used (see comment)
  • Inconsistency: apps/web/src/components/app-sidebar.tsx still uses virtualization with the same @tanstack/react-virtual library - this could experience identical React 19 issues when >100 chats are loaded
  • Performance trade-off: Acceptable for typical use cases, but could impact users with 100+ messages in a single chat

Recommendations

  • Remove unused virtualizer code or wrap in feature flag
  • Consider applying the same fix to app-sidebar.tsx if users report similar errors
  • Monitor for performance reports from users with very long chat histories

Confidence Score: 4/5

  • This PR is safe to merge - it fixes critical React errors with a simple, conservative approach
  • Score of 4/5 reflects that the fix is functionally correct and solves the reported bugs, but leaves cleanup work (dead code) and doesn't address the same potential issue in app-sidebar.tsx. The core change is minimal risk and the trade-off is well-documented.
  • No files require special attention - the change is straightforward and low-risk

Important Files Changed

File Analysis

Filename Score Overview
apps/web/src/components/chat-messages-panel.tsx 3/5 Disables virtualization to fix React 19 errors, but leaves significant dead code (virtualizer setup, refs, callbacks) that's never used

Sequence Diagram

sequenceDiagram
    participant User
    participant ChatMessagesPanel
    participant React19
    participant TanStackVirtual
    participant ScrollArea

    Note over ChatMessagesPanel: shouldVirtualize = false (HARDCODED)
    
    User->>ChatMessagesPanel: Page load/reload
    ChatMessagesPanel->>React19: Initial render
    React19->>ChatMessagesPanel: Set isMounted = false
    
    Note over TanStackVirtual: Virtualizer created but disabled
    ChatMessagesPanel->>TanStackVirtual: useVirtualizer(enabled: false)
    TanStackVirtual-->>ChatMessagesPanel: virtualizer (inactive)
    
    Note over ChatMessagesPanel: Dead code: virtualizerRef, measureElementRef, virtualListContainerStyle never used
    
    ChatMessagesPanel->>React19: useEffect() completes
    React19->>ChatMessagesPanel: Set isMounted = true
    
    Note over ChatMessagesPanel: Render path: shouldVirtualize = false
    ChatMessagesPanel->>ScrollArea: Render all messages (non-virtualized)
    ScrollArea->>User: Display all messages at once
    
    User->>ScrollArea: Scroll interaction
    ScrollArea->>ChatMessagesPanel: handleScroll event
    ChatMessagesPanel->>ChatMessagesPanel: Update isAtBottom state
    
    Note over ChatMessagesPanel,TanStackVirtual: ✅ No React 19 hydration errors<br/>✅ No infinite re-render loops<br/>⚠️ Performance impact for long chats
Loading

@greptile-apps greptile-apps Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Comments (1)

  1. apps/web/src/components/chat-messages-panel.tsx, line 133-171 (link)

    style: dead code - the virtualizer, virtualizerRef, measureElementRef, and virtualListContainerStyle are never used since shouldVirtualize is hardcoded to false

    consider removing lines 133-171 or adding a feature flag to re-enable virtualization later

    Score: 4/5 - this is definitely dead code that should be cleaned up, but it doesn't cause runtime issues

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@leoisadev1
leoisadev1 deleted the fix/disable-virtualization branch January 20, 2026 22:26

This branch was successfully deployed

1 active deployment
Preview — 29869907 Deployed Nov 27, 2025 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant