Skip to content

fix(sql): scroll long scripts inside the SQL editor (#1480)#1481

Open
shaishab316 wants to merge 1 commit intoprisma:mainfrom
shaishab316:main
Open

fix(sql): scroll long scripts inside the SQL editor (#1480)#1481
shaishab316 wants to merge 1 commit intoprisma:mainfrom
shaishab316:main

Conversation

@shaishab316
Copy link
Copy Markdown

Summary

Fixes prisma/studio#1480: the SQL console editor could grow with very long queries, stretching the layout so Run SQL (and the rest of the header) was hard to reach without zooming or resizing.

What changed

  • Constrain the SQL view layout with flex (min-h-0 / flex-1) so the editor panel has a bounded height.
  • Give CodeMirror a filled height (height="100%") so content scrolls inside the editor instead of expanding the whole view.
  • When there is no result grid, the empty result area no longer steals flex space (flex-none), so the editor can use the full pane.

How to test

  1. pnpm test -- ui/studio/views/sql/SqlView.test.tsx
  2. Run the demo (pnpm demo:ppg), open SQL Console, paste a large script, and confirm the editor scrolls internally while Run SQL stays visible in the header.

Before

image

After

image

Constrain the SQL panel with flex + overflow so CodeMirror scrolls
internally instead of growing the view. Fixes prisma#1480.
Copilot AI review requested due to automatic review settings April 4, 2026 10:37
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR fixes the SQL Console layout issue where very long queries caused the CodeMirror editor to expand vertically, pushing the header (including Run SQL) out of easy reach.

Changes:

  • Constrained the SQL view layout using flex + min-h-0/flex-1/overflow-hidden so the editor pane height is bounded.
  • Configured CodeMirror to fill available height (height="100%") so long content scrolls inside the editor.
  • Adjusted result grid container flex behavior so the empty result area doesn’t consume space when there’s no result.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ui/studio/views/sql/SqlView.tsx Introduces bounded flex layout and makes CodeMirror scroll internally; adjusts result container flexing based on presence of results.
ui/studio/views/sql/SqlView.test.tsx Adds a regression test asserting the presence of the new bounded/overflow-hidden editor container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Raw SQL editor textarea is not scrollable — "Run SQL" button becomes inaccessible

2 participants