Skip to content
Snippets Groups Projects
Unverified Commit fc789c2d authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Fix pivoted table crash (#45485)

parent fde8b90f
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,9 @@ import {
queryBuilderHeader,
modal,
withDatabase,
summarize,
visualize,
tableInteractive,
} from "e2e/support/helpers";
const { ORDERS, ORDERS_ID, PEOPLE, PEOPLE_ID, PRODUCTS, PRODUCTS_ID } =
......@@ -950,3 +953,31 @@ describe.skip("issue 25415", () => {
cy.findByTestId("TableInteractive-root").should("exist");
});
});
describe("issue 45481", () => {
beforeEach(() => {
restore();
cy.signInAsNormalUser();
});
it("should not crash when the table viz gets automatically pivoted (metabase#45481)", () => {
openOrdersTable();
openNotebook();
summarize({ mode: "notebook" });
popover().findByText("Count of rows").click();
getNotebookStep("summarize")
.findByText("Pick a column to group by")
.click();
popover().findByText("User ID").click();
getNotebookStep("summarize")
.findByTestId("breakout-step")
.icon("add")
.click();
popover().within(() => {
cy.findByText("Product").click();
cy.findByText("Category").click();
});
visualize();
tableInteractive().should("be.visible");
});
});
......@@ -338,6 +338,7 @@ class Table extends Component<TableProps, TableState> {
);
this.setState({
data: DataGrid.pivot(data, normalIndex, pivotIndex, cellIndex),
question,
});
} else {
const { cols, rows, results_timezone } = data;
......@@ -355,7 +356,6 @@ class Table extends Component<TableProps, TableState> {
rows: rows.map(row => columnIndexes.map(i => row[i])),
results_timezone,
},
// cache question for performance reasons
question,
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment