Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): layer style boolean selector field doesn't work properly with string value #1322

Merged
merged 4 commits into from
Dec 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ const booleanOptions = [
];

type Props = {
value: boolean | undefined;
value: boolean | string | undefined;
onChange: (value: boolean | undefined) => void;
};

const BooleanSelectorInput: FC<Props> = ({ value, onChange }) => {
return (
<Selector
value={value === true ? "true" : value === false ? "false" : ""}
value={
value === true ||
(typeof value === "string" && value.toLowerCase() === "true")
? "true"
: value === false ||
(typeof value === "string" && value.toLowerCase() === "false")
? "false"
: ""
}
airslice marked this conversation as resolved.
Show resolved Hide resolved
options={booleanOptions}
onChange={(v) =>
onChange(v === "true" ? true : v === "false" ? false : undefined)
Expand Down
Loading