Skip to content

Conversation

@adriancerejo
Copy link

@adriancerejo adriancerejo commented Nov 12, 2025

SUMMARY

Fixes #36042

Add white-space: pre-wrap CSS to AG Grid cells to preserve multiple consecutive whitespaces in SQL Lab query results. Previously, HTML default behavior collapsed multiple spaces into single spaces, causing issues with financial data like option symbols that require exact whitespace preservation.

Changes:

  • Add white-space: pre-wrap to .ag-cell in ThemedAgGridReact
  • Add test to verify table renders with whitespace data

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
image

After:
image

TESTING INSTRUCTIONS

  1. Go to SQL Lab
  2. Run a query with multiple spaces:
SELECT 'double  space' as text
   UNION ALL
   SELECT 'triple   space'
   UNION ALL
   SELECT 'multiple    spaces     here'
  1. Verify the result table preserves the multiple spaces (not collapsed)

ADDITIONAL INFORMATION

  • Has associated issue: DB Result Cell collapses whitespaces between characters #36042
  • 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

Fixes apache#36042

Add white-space: pre-wrap CSS to AG Grid cells to preserve multiple
consecutive whitespaces in SQL Lab query results. Previously, HTML
default behavior collapsed multiple spaces into single spaces, causing
issues with financial data like option symbols that require exact
whitespace preservation.

Changes:
- Add white-space: pre-wrap to .ag-cell in ThemedAgGridReact
- Add test to verify table renders with whitespace data
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Nov 12, 2025

Code Review Agent Run #baf350

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: c343b5c..c343b5c
    • superset-frontend/packages/superset-ui-core/src/components/ThemedAgGridReact/index.tsx
    • superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the sqllab Namespace | Anything related to the SQL Lab label Nov 12, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Functionality Global white-space pre-wrap breaks cell layout ▹ view
Performance Performance impact from forced text wrapping in grid cells ▹ view
Files scanned
File Path Reviewed
superset-frontend/packages/superset-ui-core/src/components/ThemedAgGridReact/index.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

height: 100%;
.ag-cell {
-webkit-font-smoothing: antialiased;
white-space: pre-wrap;
Copy link

Choose a reason for hiding this comment

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

Global white-space pre-wrap breaks cell layout category Functionality

Tell me more
What is the issue?

The CSS property white-space: pre-wrap is applied globally to all ag-grid cells, which will force all cell content to preserve whitespace and wrap text, potentially breaking the layout and functionality of cells that should not wrap.

Why this matters

This global styling can cause unintended visual issues such as excessive vertical spacing in cells with normal text, broken alignment in numeric columns, and poor readability in cells that are designed to display single-line content. It may also interfere with ag-grid's built-in text handling and column sizing algorithms.

Suggested change ∙ Feature Preview

Remove the global white-space: pre-wrap rule and instead apply it conditionally through column definitions or cell renderers where text wrapping is specifically needed:

.ag-cell {
  -webkit-font-smoothing: antialiased;
  /* Remove: white-space: pre-wrap; */
}

Then apply wrapping selectively via columnDefs:

const columnDefs = [
  {
    field: 'description',
    cellStyle: { 'white-space': 'pre-wrap' }, // Only for specific columns
  }
];
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

height: 100%;
.ag-cell {
-webkit-font-smoothing: antialiased;
white-space: pre-wrap;
Copy link

Choose a reason for hiding this comment

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

Performance impact from forced text wrapping in grid cells category Performance

Tell me more
What is the issue?

Adding white-space: pre-wrap to all ag-grid cells forces text wrapping and preserves whitespace, which can significantly impact rendering performance in large grids.

Why this matters

This CSS property forces the browser to calculate text wrapping for every cell, potentially causing layout thrashing and slower scrolling performance in grids with many rows or columns. The performance impact scales with grid size.

Suggested change ∙ Feature Preview

Consider applying white-space: pre-wrap conditionally only to cells that need it, or use a CSS class that can be selectively applied:

.ag-cell.wrap-text {
  white-space: pre-wrap;
}

Then apply the class only to specific column definitions that require text wrapping via the cellClass property in ag-grid column definitions.

Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

Copy link
Contributor

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

This PR fixes whitespace collapsing in SQL Lab query result cells by adding white-space: pre-wrap CSS to AG Grid cells. Previously, multiple consecutive spaces in query results were collapsed into single spaces due to HTML's default rendering behavior.

Key changes:

  • Added white-space: pre-wrap to .ag-cell in ThemedAgGridReact component
  • Added test coverage to verify data with multiple whitespaces renders correctly

Reviewed Changes

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

File Description
superset-frontend/packages/superset-ui-core/src/components/ThemedAgGridReact/index.tsx Added white-space: pre-wrap CSS property to all AG Grid cells to preserve consecutive whitespaces
superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx Added test case to verify whitespace preservation in table rendering

height: 100%;
.ag-cell {
-webkit-font-smoothing: antialiased;
white-space: pre-wrap;
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

The white-space: pre-wrap CSS property may cause performance issues in tables with many rows or long text content due to increased reflow calculations. Consider applying this only when needed (e.g., via a prop or specific column configuration) rather than globally to all cells. AG Grid provides cellClass or cellStyle options in column definitions for selective application.

Suggested change
white-space: pre-wrap;
/*
* Do NOT set white-space: pre-wrap globally for all cells.
* If you need pre-wrap for specific columns, use AG Grid's cellClass or cellStyle in your columnDefs:
* { field: 'myField', cellClass: 'pre-wrap-cell' }
* and define the CSS:
* .pre-wrap-cell { white-space: pre-wrap; }
*/

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages size/M sqllab Namespace | Anything related to the SQL Lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DB Result Cell collapses whitespaces between characters

1 participant