Skip to content

Commit

Permalink
Merge pull request #4910 from open-formulieren/issue/4884-ignore-soft…
Browse files Browse the repository at this point in the history
…-required-errors-component-variables

Ensure that no form variables are created for soft required errors
  • Loading branch information
sergei-maertens authored Dec 12, 2024
2 parents f44e7af + db8d6fe commit 3a70208
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/openforms/forms/models/form_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def create_for_formstep(self, form_step: "FormStep") -> list["FormVariable"]:
):
if (
is_layout_component(component)
or component["type"] == "content"
or component["type"] in ("content", "softRequiredErrors")
or component["key"] in existing_form_variables_keys
or component_in_editgrid(form_definition_configuration, component)
):
Expand Down
10 changes: 7 additions & 3 deletions src/openforms/js/components/admin/form_design/variables/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ const makeNewVariableFromComponent = (component, formDefinition) => {
const shouldNotUpdateVariables = (newComponent, oldComponent, mutationType, stepConfiguration) => {
// Issue #1695: content components are not considered layout components
if (newComponent.type === 'content') return true;
// Issue #4884 - soft required errors are pretty much the same as content components,
// with additional special client-side behaviour
if (newComponent.type === 'softRequiredErrors') return true;

const isLayout = FormioUtils.isLayoutComponent(newComponent);

Expand All @@ -84,9 +87,10 @@ const shouldNotUpdateVariables = (newComponent, oldComponent, mutationType, step
const getFormVariables = (formDefinition, configuration) => {
const newFormVariables = [];

FormioUtils.eachComponent(configuration.components, component =>
newFormVariables.push(makeNewVariableFromComponent(component, formDefinition))
);
FormioUtils.eachComponent(configuration.components, component => {
if (component.type === 'softRequiredErrors') return;
newFormVariables.push(makeNewVariableFromComponent(component, formDefinition));
});
return newFormVariables;
};

Expand Down

0 comments on commit 3a70208

Please sign in to comment.