Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • removed dedicated code-optimized virtualized viewer, baked it into the code component

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 7, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Dec 7, 2025 2:08am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 7, 2025

Greptile Overview

Greptile Summary

This PR consolidates the virtualized code viewer functionality into the main Code component, eliminating the separate code-optimized.tsx file.

  • Integrated VirtualizedViewerInner as a memoized component within code.tsx
  • Added virtualized prop to Code.Viewer that routes to either standard or virtualized implementation
  • Updated terminal component to use Code.Viewer with virtualized prop instead of the removed VirtualizedCodeViewer
  • Removed VirtualizedCodeViewer export from the component index

The architecture now follows a cleaner pattern where virtualization is an opt-in feature of the existing Code.Viewer component rather than a separate component.

Confidence Score: 5/5

  • This PR is safe to merge - it's a straightforward refactor that consolidates two components into one with equivalent functionality.
  • The refactor correctly preserves all existing functionality. The React hooks are properly ordered before conditional returns, imports are correctly updated, and the API surface is cleaner. No logical issues or breaking changes were introduced.
  • No files require special attention.

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/components/emcn/components/code/code.tsx 5/5 Integrated virtualized rendering into the Code component. Added VirtualizedViewerInner as a memoized component, new Viewer function routes to either standard or virtualized implementation based on prop. Hooks are correctly ordered before conditional returns.
apps/sim/components/emcn/components/code/code-optimized.tsx 5/5 Deleted standalone VirtualizedCodeViewer component. Functionality has been consolidated into the main code.tsx file.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx 5/5 Updated import from VirtualizedCodeViewer to Code, and changed usage to Code.Viewer with virtualized prop. The integration is correct and functionally equivalent.
apps/sim/components/emcn/components/index.ts 5/5 Removed VirtualizedCodeViewer export as the functionality is now accessible via Code.Viewer with virtualized prop.

Sequence Diagram

sequenceDiagram
    participant Terminal
    participant Code.Viewer
    participant VirtualizedViewerInner
    participant ViewerInner
    participant List (react-window)

    Terminal->>Code.Viewer: render with virtualized=true
    Code.Viewer->>Code.Viewer: Build innerProps
    alt virtualized=true
        Code.Viewer->>VirtualizedViewerInner: render
        VirtualizedViewerInner->>VirtualizedViewerInner: Setup hooks (listRef, containerHeight, dynamicRowHeight)
        VirtualizedViewerInner->>VirtualizedViewerInner: Process lines with syntax highlighting
        VirtualizedViewerInner->>List (react-window): render virtualized rows
        List (react-window)-->>VirtualizedViewerInner: Only visible rows rendered
    else virtualized=false
        Code.Viewer->>ViewerInner: render
        ViewerInner->>ViewerInner: Process code with syntax highlighting
        ViewerInner-->>Code.Viewer: Standard DOM rendering
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 22c9384 into staging Dec 7, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/code branch December 7, 2025 02:12
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