From 6556cb0ff1601a17b537369d88e63a33b599afb7 Mon Sep 17 00:00:00 2001 From: yelinz Date: Mon, 23 Dec 2024 09:39:15 +0100 Subject: [PATCH] fix(form-builder): default answer not selectable for choice questions --- .../cfb-form-editor/question/default.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/form-builder/addon/components/cfb-form-editor/question/default.js b/packages/form-builder/addon/components/cfb-form-editor/question/default.js index cb1bbcb6d..ee2cb0bca 100644 --- a/packages/form-builder/addon/components/cfb-form-editor/question/default.js +++ b/packages/form-builder/addon/components/cfb-form-editor/question/default.js @@ -38,11 +38,16 @@ export default class CfbFormEditorQuestionDefault extends Component { raw.meta = { widgetOverride: "cf-field/input/powerselect" }; } - const key = this.args.model.__typename - .replace(/^./, (match) => match.toLowerCase()) - .replace("Question", "Options"); - - raw[key] = raw.options; + const key = camelize( + this.args.model.__typename.replace(/Question$/, "Options"), + ); + + // Format option changesets to match the raw format needed in lib. + raw[key] = { + edges: raw.options.map((node) => { + return { node }; + }), + }; delete raw.options; }