Skip to content

Commit

Permalink
fix(sqllab): Broken query containing 'children' (apache#25490)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark committed Oct 4, 2023
1 parent dab1825 commit b92957e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import userEvent from '@testing-library/user-event';

describe('FilterableTable', () => {
const mockedProps = {
orderedColumnKeys: ['a', 'b', 'c'],
orderedColumnKeys: ['a', 'b', 'c', 'children'],
data: [
{ a: 'a1', b: 'b1', c: 'c1', d: 0 },
{ a: 'a2', b: 'b2', c: 'c2', d: 100 },
{ a: null, b: 'b3', c: 'c3', d: 50 },
{ a: 'a1', b: 'b1', c: 'c1', d: 0, children: 0 },
{ a: 'a2', b: 'b2', c: 'c2', d: 100, children: 2 },
{ a: null, b: 'b3', c: 'c3', d: 50, children: 1 },
],
height: 500,
};
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/src/components/FilterableTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ const FilterableTable = ({
usePagination={false}
columns={columns}
data={filteredList}
childrenColumnName=""
virtualize
bordered
/>
Expand Down
10 changes: 10 additions & 0 deletions superset-frontend/src/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ export interface TableProps<RecordType> {
* only supported for virtualize == true
*/
allowHTML?: boolean;

/**
* The column that contains children to display.
* Check https://ant.design/components/table#table for more details.
*/
childrenColumnName?: string;
}

const defaultRowSelection: React.Key[] = [];
Expand Down Expand Up @@ -259,6 +265,7 @@ export function Table<RecordType extends object>(
recordCount,
onRow,
allowHTML = false,
childrenColumnName,
} = props;

const wrapperRef = useRef<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -392,6 +399,9 @@ export function Table<RecordType extends object>(
theme,
height: bodyHeight,
bordered,
expandable: {
childrenColumnName,
},
};

return (
Expand Down

0 comments on commit b92957e

Please sign in to comment.