Skip to content

fix(sqllab): stop OAuth2 banner from ballooning the database selector popover - #42652

Open
yousoph wants to merge 1 commit into
apache:masterfrom
preset-io:fix-sqllab-oauth-banner-layout
Open

fix(sqllab): stop OAuth2 banner from ballooning the database selector popover#42652
yousoph wants to merge 1 commit into
apache:masterfrom
preset-io:fix-sqllab-oauth-banner-layout

Conversation

@yousoph

@yousoph yousoph commented Jul 31, 2026

Copy link
Copy Markdown
Member

SUMMARY

In SQL Lab, the "Select Database and Schema" popover shows an "Authorization needed" banner (OAuth2RedirectMessage) when the selected database uses OAuth2 and the user has not yet authorized. The banner's body text rendered as a single unwrapped monospace line, which forced the entire popover — and the Database/Schema selects inside it — to balloon to roughly 3x its normal width.

Two things combined to cause this:

  1. SqlEditorLeftBar — the popover content container had min-width: 500px but no max-width, so the antd Popover sized to max-content and grew to fit the widest child.
  2. ErrorAlert applies descriptionPre = true by default, styling the description as preformatted code (monospace fontFamilyCode + white-space: pre-wrap). The OAuth2 message body is prose, not a stack trace, so pre-wrap only wrapped against a constrained width the ballooning popover never provided.

Changes

  • OAuth2RedirectMessage now passes descriptionPre={false} so its prose body wraps normally instead of rendering as monospace preformatted text.
  • The SqlEditorLeftBar popover content is capped with max-width: 500px so its width stays constant whether or not the banner is shown.

Net effect: the popover keeps a stable width, and the authorization message wraps and uses vertical space.

BEFORE

The "Authorization needed" banner appears on one long unwrapped monospace line, stretching the popover ~3x wider and pushing the Database/Schema selects out with it.
Screenshot 2026-07-30 at 11 14 05 AM

AFTER

The popover width is unchanged from the no-banner state; the banner text wraps within the popover and flows downward.
image

TESTING INSTRUCTIONS

  1. In SQL Lab, open the database/schema selector for a database configured with OAuth2 (e.g. Snowflake OAuth) while unauthorized.
  2. Confirm the "Authorization needed" banner appears, its text wraps within the popover, and the popover width matches the no-banner state.

Unit tests: OAuth2RedirectMessage.test.tsx adds a case asserting the prose body is not rendered with preformatted/monospace (pre-wrap) styling.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

This addresses a customer-reported layout regression.

When a SQL Lab database uses OAuth2 and the user has not yet authorized,
the "Authorization needed" banner rendered inside the "Select Database and
Schema" popover displayed its body as a single unwrapped monospace line,
forcing the popover (and both selects) to ~3x their normal width. This was
reported by a customer using Snowflake OAuth.

Two fixes:
- OAuth2RedirectMessage passes descriptionPre={false} to ErrorAlert so the
  prose body renders with normal white-space (wraps naturally, non-monospace)
  instead of preformatted stack-trace styling.
- The SqlEditorLeftBar popover content now has a fixed max-width alongside its
  min-width, keeping the popover at a constant width whether or not the banner
  is showing and forcing the banner text to wrap vertically.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dosubot dosubot Bot added authentication:sso Single Sign On change:frontend Requires changing the frontend sqllab Namespace | Anything related to the SQL Lab labels Jul 31, 2026
@bito-code-review

bito-code-review Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Bito Review Skipped - Source Branch Not Found

Bito didn’t review this change because the pull request is no longer valid. It may have been merged, or the source/target branch may no longer exist.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.44%. Comparing base (8e08a65) to head (f4824ea).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42652   +/-   ##
=======================================
  Coverage   65.44%   65.44%           
=======================================
  Files        2810     2810           
  Lines      159362   159362           
  Branches    36372    36372           
=======================================
  Hits       104295   104295           
  Misses      53025    53025           
  Partials     2042     2042           
Flag Coverage Δ
javascript 71.54% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

authentication:sso Single Sign On change:frontend Requires changing the frontend size/S sqllab Namespace | Anything related to the SQL Lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant