Skip to content
Snippets Groups Projects
Unverified Commit 52c9a610 authored by pawit-metabase's avatar pawit-metabase Committed by GitHub
Browse files

Fix field filter no longer responding after selecting "None" (#17746)

Uncontrollable.jsx treats "undefined" value specially breaking
the onClick handler

Fixes #13825
parent ceb0af37
Branches
Tags
No related merge requests found
......@@ -181,14 +181,19 @@ export default class TagEditorParam extends Component {
<h4 className="text-medium pb1">{t`Filter widget type`}</h4>
<Select
className="block"
value={tag["widget-type"]}
// avoid `undefined` value because it makes the component "uncontrollable"
// (see Uncontrollable.jsx, metabase#13825)
value={tag["widget-type"] || "none"}
onChange={e =>
this.setParameterAttribute("widget-type", e.target.value)
this.setParameterAttribute(
"widget-type",
e.target.value === "none" ? undefined : e.target.value,
)
}
isInitiallyOpen={!tag["widget-type"] && hasWidgetOptions}
placeholder={t`Select…`}
>
{[{ name: "None", type: undefined }]
{[{ name: "None", type: "none" }]
.concat(widgetOptions)
.map(widgetOption => (
<Option key={widgetOption.type} value={widgetOption.type}>
......
......@@ -45,7 +45,7 @@ describe("scenarios > filters > sql filters > field filter > None", () => {
cy.findByText("Showing 200 rows");
});
it.skip("should let you change the field filter type to something else and restore the filter widget (metabase#13825)", () => {
it("should let you change the field filter type to something else and restore the filter widget (metabase#13825)", () => {
FieldFilter.setWidgetType("String contains");
FieldFilter.openEntryForm();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment