Skip to content
Snippets Groups Projects
Unverified Commit 72893a8f authored by Anton Kulyk's avatar Anton Kulyk Committed by GitHub
Browse files

Fix dashcard query sometimes errors after replacing its card (#36987)

parent 61025e03
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,14 @@ const PARAMETER = {
name: "Not mapped to anything",
type: "number/=",
}),
// Used to reproduce:
// https://github.com/metabase/metabase/issues/36984
DATE_2: createMockParameter({
id: "2",
name: "Created At (2)",
type: "date/range",
}),
};
const DASHBOARD_CREATE_INFO = {
......@@ -63,6 +71,11 @@ function getDashboardCards(mappedQuestionId) {
card_id: mappedQuestionId,
target: ["dimension", ["field", PRODUCTS.CREATED_AT, null]],
},
{
parameter_id: PARAMETER.DATE_2.id,
card_id: mappedQuestionId,
target: ["dimension", ["field", PRODUCTS.CREATED_AT, null]],
},
{
parameter_id: PARAMETER.CATEGORY.id,
card_id: mappedQuestionId,
......@@ -114,7 +127,7 @@ describe("scenarios > dashboard cards > replace question", () => {
);
});
it("should replace a dashboard card question", () => {
it("should replace a dashboard card question (metabase#36984)", () => {
visitDashboardAndEdit();
findDashCardAction(findHeadingDashcard(), "Replace").should("not.exist");
......
import {
describeEE,
editDashboard,
popover,
restore,
saveDashboard,
sendEmailAndVisitIt,
setTokenFeatures,
setupSMTP,
......@@ -52,7 +54,7 @@ describeEE("issue 24223", () => {
});
function addParametersToDashboard() {
cy.icon("pencil").click();
editDashboard();
// add Category > Dropdown "Category" filter
cy.icon("filter").click();
......@@ -75,7 +77,5 @@ function addParametersToDashboard() {
popover().find("input").type("Awesome");
popover().button("Add filter").click();
cy.findByText("Save").click();
// wait for dashboard to save
cy.contains("You're editing this dashboard.").should("not.exist");
saveDashboard();
}
......@@ -11,6 +11,7 @@ import { clickBehaviorIsValid } from "metabase-lib/parameters/utils/click-behavi
import { trackDashboardSaved } from "../analytics";
import { getDashboardBeforeEditing } from "../selectors";
import { setEditingDashboard } from "./core";
import { fetchDashboard, fetchDashboardCardData } from "./data-fetching";
import { hasDashboardChanged, haveDashboardCardsChanged } from "./utils";
......@@ -130,6 +131,8 @@ export const updateDashboardAndCards = createThunkAction(
duration_milliseconds,
});
dispatch(setEditingDashboard(false));
// make sure that we've fully cleared out any dirty state from editing (this is overkill, but simple)
await dispatch(
fetchDashboard({
......
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