Skip to content

File preview modal freezes when rendering large code files in Skill Workshop #99062

Description

@xianshishan

Problem

When viewing generated skills in the Skill Workshop, opening the "Support files" preview modal causes severe page lag and freezing, especially when the proposal includes large code files (up to 256 KB per file).

Root Cause

In ui/src/ui/components/file-preview-modal.ts, the entire file content is rendered as a single giant <pre> text node:

<pre class="pre">${file.contents}</pre>

For a 256 KB file with ~5000 lines, the browser must layout and paint the entire content as one monolithic DOM node. When scrolling through the code, the browser struggles to repaint such a large text node, causing visible stutter and freezing.

All support file contents are also eagerly loaded into memory at inspect time via the skills.proposals.inspect RPC, and passed to the modal component as a single array property.

Steps to Reproduce

  1. Open the Skill Workshop (/skills/workshop)
  2. Select a proposal that has support files with large code content (e.g., 100+ KB source files)
  3. Click "Support files" to open the file preview modal
  4. Scroll through the code in the detail pane — observe significant lag and freezing

Expected Behavior

Scrolling through code files should be smooth regardless of file size. Only the lines visible in the viewport (plus a small buffer) should be rendered.

Suggested Fix

Implement virtual scrolling for the code viewer — render only the visible lines plus overscan buffer, using spacer elements to maintain correct scrollbar dimensions. The same approach used by code editors and large-list UIs.

Environment

  • OpenClaw Control UI
  • ui/src/ui/components/file-preview-modal.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions