Skip to content
Snippets Groups Projects
Unverified Commit 2b7216ab authored by metabase-bot[bot]'s avatar metabase-bot[bot] Committed by GitHub
Browse files

Fixes notebook editor not working for pivot questions until results are loaded (#28945) (#28965)

parent d424ec40
No related branches found
No related tags found
No related merge requests found
import { restore, visitQuestionAdhoc } from "e2e/support/helpers";
import { SAMPLE_DB_ID } from "e2e/support/cypress_data";
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
const { ORDERS, ORDERS_ID } = SAMPLE_DATABASE;
const questionDetails = {
name: "28874",
display: "pivot",
dataset_query: {
database: SAMPLE_DB_ID,
type: "query",
query: {
"source-table": ORDERS_ID,
aggregation: [["count"]],
breakout: [
["field", ORDERS.CREATED_AT, { "temporal-unit": "year" }],
["field", ORDERS.PRODUCT_ID, null],
],
},
},
};
describe("issue 28874", () => {
beforeEach(() => {
restore();
cy.signInAsNormalUser();
});
it("should allow to modify a pivot question in the notebook (metabase#28874)", () => {
visitQuestionAdhoc(questionDetails, { mode: "notebook" });
cy.findByText("Product ID")
.parent()
.within(() => cy.icon("close").click());
cy.findByText("Product ID").should("not.exist");
});
});
......@@ -169,12 +169,15 @@ export const updateQuestion = (
if (isPivot && hasBreakouts) {
const key = "pivot_table.column_split";
const rawSeries = getRawSeries(getState()) as Series;
const series = assocIn(rawSeries, [0, "card"], newQuestion.card());
const setting = getQuestionWithDefaultVisualizationSettings(
newQuestion,
series,
).setting(key);
newQuestion = newQuestion.updateSettings({ [key]: setting });
if (rawSeries) {
const series = assocIn(rawSeries, [0, "card"], newQuestion.card());
const setting = getQuestionWithDefaultVisualizationSettings(
newQuestion,
series,
).setting(key);
newQuestion = newQuestion.updateSettings({ [key]: setting });
}
}
run = checkShouldRerunPivotTableQuestion({
......
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