Skip to content

Commit b92957e

Browse files
authored
fix(sqllab): Broken query containing 'children' (#25490)
1 parent dab1825 commit b92957e

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import userEvent from '@testing-library/user-event';
2525

2626
describe('FilterableTable', () => {
2727
const mockedProps = {
28-
orderedColumnKeys: ['a', 'b', 'c'],
28+
orderedColumnKeys: ['a', 'b', 'c', 'children'],
2929
data: [
30-
{ a: 'a1', b: 'b1', c: 'c1', d: 0 },
31-
{ a: 'a2', b: 'b2', c: 'c2', d: 100 },
32-
{ a: null, b: 'b3', c: 'c3', d: 50 },
30+
{ a: 'a1', b: 'b1', c: 'c1', d: 0, children: 0 },
31+
{ a: 'a2', b: 'b2', c: 'c2', d: 100, children: 2 },
32+
{ a: null, b: 'b3', c: 'c3', d: 50, children: 1 },
3333
],
3434
height: 500,
3535
};

superset-frontend/src/components/FilterableTable/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ const FilterableTable = ({
366366
usePagination={false}
367367
columns={columns}
368368
data={filteredList}
369+
childrenColumnName=""
369370
virtualize
370371
bordered
371372
/>

superset-frontend/src/components/Table/index.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ export interface TableProps<RecordType> {
150150
* only supported for virtualize == true
151151
*/
152152
allowHTML?: boolean;
153+
154+
/**
155+
* The column that contains children to display.
156+
* Check https://ant.design/components/table#table for more details.
157+
*/
158+
childrenColumnName?: string;
153159
}
154160

155161
const defaultRowSelection: React.Key[] = [];
@@ -259,6 +265,7 @@ export function Table<RecordType extends object>(
259265
recordCount,
260266
onRow,
261267
allowHTML = false,
268+
childrenColumnName,
262269
} = props;
263270

264271
const wrapperRef = useRef<HTMLDivElement | null>(null);
@@ -392,6 +399,9 @@ export function Table<RecordType extends object>(
392399
theme,
393400
height: bodyHeight,
394401
bordered,
402+
expandable: {
403+
childrenColumnName,
404+
},
395405
};
396406

397407
return (

0 commit comments

Comments
 (0)