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

[#5124] Hidden/disabled prefill fields trigger validation #5135

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

vaszig
Copy link
Contributor

@vaszig vaszig commented Mar 4, 2025

Closes #5124

Changes

  • When a component (or its parent is disabled and hidden, the validation in the backend is triggered since there is no data for the specific key. This means, for our validator, that the data has been changed and raises an error.

  • Additional test for the case someone omits the submission data (affects the prefill data).

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

@vaszig vaszig marked this pull request as draft March 4, 2025 13:50
When  a component (or its parent is disabled and hidden, the validation in the backend is
triggered since there is no data for the specific key. This means, for our validator,
that the data has been changed and raises an error.
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.74%. Comparing base (069f6d5) to head (8b7c2f6).
Report is 44 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5135      +/-   ##
==========================================
- Coverage   96.75%   96.74%   -0.01%     
==========================================
  Files         777      779       +2     
  Lines       26724    26776      +52     
  Branches     3474     3484      +10     
==========================================
+ Hits        25856    25905      +49     
- Misses        606      607       +1     
- Partials      262      264       +2     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vaszig vaszig marked this pull request as ready for review March 4, 2025 14:30
@vaszig vaszig marked this pull request as draft March 4, 2025 16:57
@vaszig vaszig marked this pull request as ready for review March 4, 2025 17:00
@vaszig vaszig requested a review from viktorvanwijk March 7, 2025 06:58
@viktorvanwijk
Copy link
Contributor

Just a failing end-to-end test, but probably flakiness by the looks of it :)

@vaszig
Copy link
Contributor Author

vaszig commented Mar 7, 2025

Just a failing end-to-end test, but probably flakiness by the looks of it :)

Yes, I remember this failing in master as well. I re-run the CI one more time to see if this is the case.

@sergei-maertens sergei-maertens added the needs-backport Fix must be backported to stable release branch label Mar 8, 2025
This ensures that if a field is prefilled but not hidden and the data is omitted from
the submission data, the initial prefill data is persisted in the database.
So, if a user clears a prefilled field that is read-only we make sure
that this will not affect the real value of the variable.
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.

unused/hidden read-only prefill fields trigger error
3 participants