Skip to content
Snippets Groups Projects
Unverified Commit e970a733 authored by Paul Rosenzweig's avatar Paul Rosenzweig Committed by GitHub
Browse files

use passed field prop if getObject select returns null (#11562)

parent 71fc90d1
No related branches found
No related tags found
No related merge requests found
......@@ -32,9 +32,10 @@ const mapDispatchToProps = {
};
function mapStateToProps(state, { field }) {
return {
field: field && Fields.selectors.getObject(state, { entityId: field.id }),
};
const selectedField =
field && Fields.selectors.getObject(state, { entityId: field.id });
// try and use the selected field, but fall back to the one passed
return { field: selectedField || field };
}
type Props = {
......
import { signInAsAdmin } from "__support__/cypress";
describe("custom question", () => {
beforeEach(signInAsAdmin);
it("should allow post-aggregation filters", () => {
// count orders by user id, filter to the one user with 46 orders
cy.visit("/question/new");
cy.contains("Custom question").click();
cy.contains("Sample Dataset").click();
cy.contains("Orders").click();
cy.contains("Pick the metric").click();
cy.contains("Count of rows").click();
cy.contains("Pick a column to group by").click();
cy.contains("User ID").click();
cy.get(".Icon-filter").click();
cy.get(".Icon-int").click();
cy.get(".PopoverBody input").type("46");
cy.get(".PopoverBody")
.contains("Add filter")
.click();
cy.contains("Visualize").click();
cy.contains("2372"); // user's id in the table
cy.contains("Showing 1 row"); // ensure only one user was returned
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment