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

Bug/4727 crashing form after changing user variable to array #4797

Conversation

robinmolen
Copy link
Contributor

@robinmolen robinmolen commented Oct 28, 2024

Closes #4727

Changes

Fixes the crashes on user variable dataType change, when a initialValue is defined. This crash happend when changing any dataType to the array dataType, because the component for the array dataType used the .some js array function. (It expected that the value was an array, so this function was used without any checks)

To resolve this situation, and possible similar situations in the future, the initialValue now gets transformed when the dataType changes. This transformation could result into losing the previous initialValue. To make sure that the dataType change is intentional, a confirmation message will be shown.

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
  • Commit hygiene

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

@robinmolen robinmolen linked an issue Oct 28, 2024 that may be closed by this pull request
@robinmolen robinmolen force-pushed the bug/4727-crashing-form-after-changing-user-variable-to-array branch from 0d09286 to b723424 Compare October 28, 2024 13:42
@robinmolen robinmolen added the needs-backport Fix must be backported to stable release branch label Oct 28, 2024
@robinmolen robinmolen marked this pull request as ready for review October 28, 2024 13:48
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.55%. Comparing base (7a6e0d3) to head (1352126).
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4797   +/-   ##
=======================================
  Coverage   96.55%   96.55%           
=======================================
  Files         748      748           
  Lines       25413    25413           
  Branches     3358     3358           
=======================================
  Hits        24538    24538           
  Misses        610      610           
  Partials      265      265           

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

@robinmolen robinmolen marked this pull request as draft October 28, 2024 14:02
@robinmolen robinmolen force-pushed the bug/4727-crashing-form-after-changing-user-variable-to-array branch from b723424 to 4e29c3a Compare October 28, 2024 14:23
@robinmolen robinmolen marked this pull request as ready for review October 28, 2024 14:31
@robinmolen robinmolen force-pushed the bug/4727-crashing-form-after-changing-user-variable-to-array branch from 4e29c3a to 037c4a1 Compare October 29, 2024 08:53
src/openforms/js/lang/nl.json Outdated Show resolved Hide resolved
src/openforms/js/lang/nl.json Outdated Show resolved Hide resolved
src/openforms/js/components/admin/form_design/utils.js Outdated Show resolved Hide resolved
src/openforms/js/components/admin/form_design/utils.js Outdated Show resolved Hide resolved
src/openforms/js/components/admin/form_design/utils.js Outdated Show resolved Hide resolved
src/openforms/js/components/admin/form_design/utils.js Outdated Show resolved Hide resolved
@robinmolen robinmolen force-pushed the bug/4727-crashing-form-after-changing-user-variable-to-array branch from 037c4a1 to 790d461 Compare November 7, 2024 14:53
@sergei-maertens sergei-maertens force-pushed the bug/4727-crashing-form-after-changing-user-variable-to-array branch from 790d461 to 1352126 Compare November 8, 2024 15:35
@sergei-maertens sergei-maertens merged commit d387129 into master Nov 8, 2024
34 checks passed
@sergei-maertens sergei-maertens deleted the bug/4727-crashing-form-after-changing-user-variable-to-array branch November 8, 2024 16:26
@sergei-maertens
Copy link
Member

Backports:

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.

Changing variable type of user variable can crash the form editor
2 participants