Skip to content

Commit

Permalink
Optimize isVisualizationClickable check in TableInteractive (#42639)
Browse files Browse the repository at this point in the history
* Optimize isVisualizationClickable check in TableInteractive

* Destructure question

* Mode is nullable
  • Loading branch information
uladzimirdev committed May 14, 2024
1 parent 1519acb commit df92623
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -727,16 +727,25 @@ class TableInteractive extends Component {
getColumnTitle,
getColumnSortDirection,
renderTableHeaderWrapper,
question,
mode,
} = this.props;
const { dragColIndex, showDetailShortcut } = this.state;
const { cols } = data;
const column = cols[columnIndex];

const query = question?.query();
const stageIndex = -1;

const columnTitle = getColumnTitle(columnIndex);
const clicked = this.getHeaderClickedObject(data, columnIndex, isPivoted);
const isDraggable = !isPivoted;
const isDragging = dragColIndex === columnIndex;
const isClickable = this.visualizationIsClickable(clicked);
const isClickable = Boolean(
mode?.hasDrills &&
query &&
Lib.queryDisplayInfo(query, stageIndex).isEditable,
);
const isSortable = isClickable && column.source && !isPivoted;
const isRightAligned = isColumnRightAligned(column);

Expand All @@ -745,9 +754,6 @@ class TableInteractive extends Component {
const isAscending = sortDirection === "asc";

const columnInfoPopoverTestId = "field-info-popover";
const question = this.props.question;
const query = question?.query();
const stageIndex = -1;

return (
<TableDraggable
Expand Down

0 comments on commit df92623

Please sign in to comment.