kokhlo commented on code in PR #44665:
URL: https://github.com/apache/superset/pull/44665#discussion_r4155376107
##########
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:
##########
@@ -1316,19 +1391,19 @@ export default function TableChart<D extends DataRecord
= DataRecord>(
// render `Cell`. This saves some time for large tables.
return (
<StyledCell {...cellProps}>
- {valueRange && (
+ {cellDrawsBar ? (
<div
/* The following classes are added to support custom CSS
styling */
className={cx(
'cell-bar',
- typeof value === 'number' && value < 0
+ numericValue !== undefined && numericValue < 0
? 'negative'
: 'positive',
)}
- css={cellBarStyles}
+ style={cellBarStyles}
Review Comment:
Good catch — that was a real regression, not a preference.
The `css` prop was not an option here, so I did not reach for it: this
codebase's Jest/Babel config does not wire up the emotion JSX pragma, and a
`css` block on a plain DOM element is silently dropped under test — I confirmed
that with a throwaway probe, which produced no rule at all. That is why I
reached for an inline `style`, and inline styles outrank every stylesheet, so
`.cell-bar.positive { background-color: red; }` became dead weight without
`!important`.
`aa15c9a` → `91d0f4f`: the bar is a `styled` div and the geometry arrives as
transient props, so the values are interpolated into a real rule instead of an
attribute. A `styled` component does not need the JSX pragma, which is what
makes it work in both the app and this repo's tests. Two things follow:
- the width assertions still have something to read — `barWidth` now reads
the emitted rule off the stylesheet rather than the style attribute;
- a new case asserts the bar carries no inline style, so this specific
regression cannot come back silently. I checked it fails when an inline
`background-color` is put back.
Full file: 111 passed. `oxlint` and `oxfmt --check` clean. `tsc --noEmit`
reports 598 pre-existing `TS6305` errors from unbuilt `lib/` output, identical
count on the parent commit, none in the files I touched.
One thing I did not verify: I checked the override structurally (no inline
style, geometry in a rule) rather than by rendering a dashboard with custom CSS
in a browser, so if you want the end-to-end confirmation that is worth a look
on your side.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]