Skip to content

fix: cell viewer modal renders blank — value content not visible inside the modal #217

Closed

Description

@EVWorth

Summary

When a user double-clicks a truncated cell value to open the full-content viewer (CellViewerModal), the modal's content area appears empty/clipped — only the header (column name + type badge + character count) and the footer (Download / Copy / Close buttons) are visible. The actual value is not rendered inside the modal, even though the modal is opened correctly and metadata like 61 characters is shown.

Steps to reproduce

  1. Run a query returning a long value (e.g. a TEXT column with 60+ characters)
  2. Double-click the truncated cell to open the viewer
  3. Modal opens showing the column name (title), type badge (TEXT), character count (61 characters), and the bottom action bar
  4. Expected: the value text is visible in the middle content area
  5. Actual: the middle area is blank; only the metadata header and button row render

Screenshot

Attached by reporter. The middle band between the metadata header and the Download/Copy/Close footer is empty.

Root cause

The Monaco-based viewer is rendered inside a doubly-overflow-hidden container in src/components/grid/CellViewerModal.tsx:238-275:

<div className="min-h-0 flex-1 p-4">                              // line 238 — flex-1 fills the available height
  <div className="h-full overflow-hidden rounded border ...">     // line 239 — h-full + overflow-hidden wrapper
    <Editor
      height="100%"
      language={language}
      value={viewerContent}                                       // line 250 — the actual value
      onMount={onMount}
      ...
      options={{ ..., automaticLayout: true, ... }}               // line 268
    />
  </div>
</div>

Two layered issues combine to produce the blank render:

  1. Monaco inside nested overflow-hidden containers fails to size correctly on cold mount. Monaco measures its container to compute its layout; when wrapped in an outer overflow-hidden (line 239) that is itself inside another overflow-managed parent (line 238's flex-1 + the modal's overall overflow-hidden), Monaco can initialize with a 0×0 or stale box, leaving the rendered text invisible until the next resize event. automaticLayout: true helps, but is not always sufficient when the container chain contains multiple overflow-hidden layers.

  2. No key on <Editor> forces re-init per open. The <Editor> is mounted once when CellViewerModal first mounts. Subsequent openings of the modal with new content reuse the same Monaco instance. When the value changes from null → 61-char string → another value, Monaco's internal model updates but the rendered viewport may stay blank if Monaco's layout hadn't fully recovered from the prior 0-size measurement.

Proposed fix

src/components/grid/CellViewerModal.tsx:238-275 — try the following changes in order (each is independent; the first alone may be sufficient):

1. Force Monaco re-init per open

Add a key to <Editor> that changes when the displayed content changes:

<Editor
  key={`${columnName}-${displayContent?.length ?? 0}`}
  height="100%"
  ...
/>

This guarantees a fresh Monaco instance each time the viewer opens with different content, eliminating any stale-layout state.

2. Remove the redundant overflow-hidden wrapper

Drop the wrapper <div className="h-full overflow-hidden rounded border ..."> at line 239 — give those classes to the Monaco host instead, or use <div className="flex-1 min-h-0 rounded border ..."> so Monaco's own internal scrolling works without competing with an outer clip context.

3. Ensure the Monaco container has an explicit width

Monaco's default width: 100% requires its parent to have a determined width. Inside the modal flex column the width is computed correctly, but if step 2 changes the wrapper, double-check that the Monaco host has w-full (or that its parent flex chain still resolves width).

Verification

  1. Run a query with a long value (≥60 chars)
  2. Double-click the cell — value text should appear immediately in the modal
  3. Close the modal, double-click a different cell with a different long value — text should appear immediately
  4. Open a value, edit it, save — re-open the same cell — value should still render
  5. Open a NULL cell — NULL placeholder text should render (regression check on the conditional at line 240)

Out of scope

  • Replacing Monaco with <pre> / <textarea> (Monaco gives syntax highlighting for JSON/SQL/markdown and is intentionally the viewer — the fix is layout, not a rewrite)
  • Changing the modal's header / footer (working as designed)
  • Adjusting the modal's overall size or position

Files

  • src/components/grid/CellViewerModal.tsx:238-275 — content area
  • src/components/grid/CellViewerModal.tsx:109 — viewerContent derivation (verify the value chain content prop → displayContent → formattedContent → viewerContent is intact)

Activity

  1. added
    bug
    good first issue
    on Jul 19, 2026
  2. self-assigned this
    on Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions