-
Notifications
You must be signed in to change notification settings - Fork 16.2k
fix(sqllab): preserve multiple whitespaces in query result cells #36090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(sqllab): preserve multiple whitespaces in query result cells #36090
Conversation
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
Code Review Agent Run #baf350Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
There was a problem hiding this 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 |
|---|---|---|
| Global white-space pre-wrap breaks cell layout ▹ view | ||
| 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.
| height: 100%; | ||
| .ag-cell { | ||
| -webkit-font-smoothing: antialiased; | ||
| white-space: pre-wrap; |
There was a problem hiding this comment.
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 
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
💬 Looking for more details? Reply to this comment to chat with Korbit.
| height: 100%; | ||
| .ag-cell { | ||
| -webkit-font-smoothing: antialiased; | ||
| white-space: pre-wrap; |
There was a problem hiding this comment.
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 
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
💬 Looking for more details? Reply to this comment to chat with Korbit.
There was a problem hiding this 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-wrapto.ag-cellin 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; |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
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.
| 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; } | |
| */ |
SUMMARY
Fixes #36042
Add
white-space: pre-wrapCSS 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:
white-space: pre-wrapto.ag-cellin ThemedAgGridReactBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:

After:

TESTING INSTRUCTIONS
ADDITIONAL INFORMATION