Skip to content

Commit

Permalink
fix(form-builder): don't evaluate option isHidden jexl in form-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
luytena committed Jan 30, 2025
1 parent d5ef8e3 commit 88a9306
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div class="uk-margin">
<@labelComponent />

{{! Default values for ChoiceQuestions and MultipleChoiceQuestion options are not updated
when a new one is added because the object returned by `this.field` is too nested to track properly. }}
<div class="uk-form-controls">
{{component
(get-widget this.field.question)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ export default class CfbFormEditorQuestionDefault extends Component {
// Format option changesets to match the raw format needed in lib.
raw[key] = {
edges: raw.options.map((node) => {
return { node };
return {
node: {
...node.get("data"),
...node.get("change"),
// While we want the real value of the option, the option should never
// be hidden in the form-builder. We need to set a value here as no
// value will lead to a Jexl error.
isHidden: "false",
},
};
}),
};
delete raw.options;
Expand Down
1 change: 1 addition & 0 deletions packages/form-builder/translations/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ caluma:
delete: "Elimina opzione"
archive: "Archivia (nascondi) opzione"
restore: "Ripristina opzione"
show-jexl: "Mostra JEXL"

notification:
form:
Expand Down

0 comments on commit 88a9306

Please sign in to comment.