diff --git a/src/services/BlockService/CheckboxProcessor.tsx b/src/services/BlockService/CheckboxProcessor.tsx index aad0151c..c2c7c41b 100644 --- a/src/services/BlockService/CheckboxProcessor.tsx +++ b/src/services/BlockService/CheckboxProcessor.tsx @@ -24,12 +24,15 @@ export const processCheckboxes = async (flow: Flow, block: Block, path: keyof Fl if (parsedCheckboxes instanceof Promise) { parsedCheckboxes = await parsedCheckboxes; } - } else if (Array.isArray(checkboxes)) { - parsedCheckboxes = {items: checkboxes}; } else { parsedCheckboxes = checkboxes; } + // if array provided, transform to object with default values + if (Array.isArray(parsedCheckboxes)) { + parsedCheckboxes = {items: parsedCheckboxes}; + } + // nothing to render if no items present if (!("items" in parsedCheckboxes)) { return; diff --git a/src/services/BlockService/OptionProcessor.tsx b/src/services/BlockService/OptionProcessor.tsx index dabc7112..c51c14b4 100644 --- a/src/services/BlockService/OptionProcessor.tsx +++ b/src/services/BlockService/OptionProcessor.tsx @@ -24,12 +24,15 @@ export const processOptions = async (flow: Flow, block: Block, path: keyof Flow, if (parsedOptions instanceof Promise) { parsedOptions = await parsedOptions; } - } else if (Array.isArray(options)) { - parsedOptions = {items: options}; } else { parsedOptions = options; } + // if array provided, transform to object with default values + if (Array.isArray(parsedOptions)) { + parsedOptions = {items: parsedOptions}; + } + // nothing to render if no items present if (!("items" in parsedOptions)) { return;