sadpandajoe commented on code in PR #45124:
URL: https://github.com/apache/superset/pull/45124#discussion_r4236592345
##########
superset-frontend/packages/superset-ui-core/src/components/Table/VirtualTable.tsx:
##########
@@ -141,7 +141,7 @@ const VirtualTable = <RecordType extends object>(
allowHTML = false,
} = props;
const [tableWidth, setTableWidth] = useState<number>(0);
- const onResize = useCallback((width?: number) => {
+ const onResize = useCallback(({ width }: ResizePayload) => {
Review Comment:
`onResize` now expects `{ width }`, but the `react-resize-detector` mock in
`VirtualTable.test.tsx` still calls `onResize?.(mockTableWidth)` with a bare
number (line 34, typed `(width?: number) => void` at line 31). Destructuring a
number gives `width === undefined`, so `tableWidth` falls back to 0 and
`virtualized table header includes the stretched last column` fails (expected
`400px`, received `300px`). Can that mock be updated to pass `{ width:
mockTableWidth }`?
##########
superset-frontend/packages/superset-ui-core/src/components/MetadataBar/MetadataBar.tsx:
##########
@@ -195,14 +195,14 @@ const MetadataBar = ({ items, tooltipPlacement = 'top' }:
MetadataBarProps) => {
}
const onResize = useCallback(
- (width: number | undefined) => {
+ ({ width }: ResizePayload) => {
Review Comment:
`onResize` now destructures `{ width }` from a payload object, but
`MetadataBar.test.tsx` still drives it the old way: `props.onResize(80)` (line
50), and `jest.spyOn(resizeDetector, 'useResizeDetector')` (line 45) throws
`Cannot redefine property: useResizeDetector` now that the package is ESM-only.
That is why `lint-frontend` fails on `MetadataBar.test.tsx(47,26)`/`(50,22)`
and the collapsed-bar tests in the jest shard fail before they render. Could
the test switch to a `jest.mock('react-resize-detector', ...)` factory that
calls `onResize({ width: 80, height: undefined, entry: undefined })`?
--
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]