Skip to content

Commit

Permalink
memo for expandedColumns
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark committed Nov 6, 2024
1 parent e478116 commit dd20be5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions superset-frontend/src/SqlLab/components/ResultSet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const ROWS_CHIP_WIDTH = 100;
const GAP = 8;

const extensionsRegistry = getExtensionsRegistry();
const EMPTY: string[] = [];

const ResultSet = ({
cache = false,
Expand Down Expand Up @@ -213,6 +214,10 @@ const ResultSet = ({
() => query.results?.columns.map(col => col.column_name),
[query.results?.columns],
);
const expandedColumns = useMemo(
() => query.results?.expanded_columns.map(col => col.column_name) ?? EMPTY,
[query.results?.expanded_columns],
);

const history = useHistory();
const dispatch = useDispatch();
Expand Down Expand Up @@ -646,9 +651,6 @@ const ResultSet = ({
({ data } = results);
}
if (data && data.length > 0) {
const expandedColumns = results.expanded_columns
? results.expanded_columns.map(col => col.column_name)
: [];
const allowHTML = getItem(
LocalStorageKeys.SqllabIsRenderHtmlEnabled,
true,
Expand Down

0 comments on commit dd20be5

Please sign in to comment.