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

Fix x-ray dashboards crash on first open (#18045)

parent c51553d6
No related branches found
No related tags found
No related merge requests found
......@@ -250,7 +250,7 @@ export function setParameterDefaultValue(
export function hasMapping(parameter, dashboard) {
return dashboard.ordered_cards.some(ordered_card => {
return ordered_card.parameter_mappings.some(parameter_mapping => {
return ordered_card?.parameter_mappings?.some(parameter_mapping => {
return parameter_mapping.parameter_id === parameter.id;
});
});
......
......@@ -210,6 +210,13 @@ describe("meta/Dashboard", () => {
expect(hasMapping(parameter, dashboard)).toBe(false);
});
it("should return false when missing parameter mappings", () => {
const dashboard = {
ordered_cards: [{ parameter_mappings: undefined }],
};
expect(hasMapping(parameter, dashboard)).toBe(false);
});
it("should return false when there are no matching parameter mapping parameter_ids", () => {
const dashboard = {
ordered_cards: [
......
......@@ -136,7 +136,7 @@ describe("scenarios > x-rays", () => {
});
});
it.skip("should be able to save an x-ray as a dashboard and visit it immediately (metabase#18028)", () => {
it("should be able to save an x-ray as a dashboard and visit it immediately (metabase#18028)", () => {
cy.visit("/");
cy.contains("A look at your Orders table").click();
......
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