Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation issue with (dynamically) optional field #4114

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

sergei-maertens
Copy link
Member

@sergei-maertens sergei-maertens commented Apr 3, 2024

Taiga DH 671

If the test suite passes first try I'm eating my shoe.

Needs backport to stable/2.6.x

The component changes properties dynamically, and the logic evaluation
seems to be missing some components.
... because of Formio configuration not being updated correctly
while the entire submission logic is being evaluated.
@sergei-maertens sergei-maertens added the needs-backport Fix must be backported to stable release branch label Apr 3, 2024
Copy link

codecov bot commented Apr 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.10%. Comparing base (f51704e) to head (0695f46).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4114   +/-   ##
=======================================
  Coverage   96.10%   96.10%           
=======================================
  Files         730      730           
  Lines       23090    23090           
  Branches     2698     2698           
=======================================
  Hits        22190    22190           
  Misses        638      638           
  Partials      262      262           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Viicos Viicos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if I understand correctly this was a bug before backend validation, but only appears now with this validation?

Comment on lines +211 to 212
mutation_operations: list[ActionOperation] = []
for operation in iter_evaluate_rules(rules, data_container, submission):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this can be built using a list comprehension now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a list comprehension makes the code look pure, but it isn't, data mutations are applied as the logic rules are evaluated by looping through them.

@sergei-maertens
Copy link
Member Author

So if I understand correctly this was a bug before backend validation, but only appears now with this validation?

No, because the logic evaluation for the entire submission runs after all form steps have been submitted. It was deliberate to skip the property actions, since they affect the UI/client side validation, but that was not presented anymore because the user is on the "confirmation" screen.

@sergei-maertens sergei-maertens merged commit 2f4bae7 into master Apr 4, 2024
26 of 27 checks passed
@sergei-maertens sergei-maertens deleted the issue/dh-671-validation-blank branch April 4, 2024 10:26
sergei-maertens added a commit that referenced this pull request Apr 4, 2024
... because of Formio configuration not being updated correctly
while the entire submission logic is being evaluated.

Backport-of: #4114
@sergei-maertens
Copy link
Member Author

Backported to stable/2.6.x in b0dc21d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-backport Fix must be backported to stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants