Skip to content

Commit

Permalink
fix(form-builder): default answer not selectable for choice questions
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelinz committed Dec 23, 2024
1 parent 259e571 commit 6556cb0
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6556cb0

Please sign in to comment.