Skip to content

Commit

Permalink
Merge pull request #3246 from bettyblocks/feat/fix-pagestate-for-chec…
Browse files Browse the repository at this point in the history
…kbox-PAGE-3402

Feat/fix pagestate for checkbox page 3402
  • Loading branch information
M-Ryan92 authored Oct 17, 2023
2 parents 663b300 + db32720 commit 9177fc6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/checkboxinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
const isDev = env === 'dev';

function boolify(textValue) {
if (typeof textValue === 'boolean') {
return textValue;
}
return ['on', 'true', 'yes'].includes(textValue.trim().toLowerCase());
}

Expand All @@ -30,7 +33,8 @@
const parsedLabel = useText(label);
const labelText = parsedLabel;
const resolvedValue = useText(value);
const [checked, setChecked] = usePageState(boolify(resolvedValue));
const [checkedState, setChecked] = usePageState(resolvedValue);
const checked = boolify(checkedState);
const dataComponentAttributeValue = useText(dataComponentAttribute);
const helperTextResolved = useText(helperText);
const validationValueMissingText = useText(validationValueMissing);
Expand Down

0 comments on commit 9177fc6

Please sign in to comment.