XGovFormBuilder / digital-form-builder

Exploring how to quickly and easily design/prototype/deploy high quality digital forms for UK Gov. Based on the excellent work by DEFRA. Currently maintained by jen+forms@cautionyourblast.com at Caution Your Blast and a community collaboration between FCDO, HO, GDS, DfE, DIT, Version 1, UKHSA
https://digital-form-builder-designer.herokuapp.com/app
MIT License
58 stars 34 forks source link

Bug: multiple exposed fields in a section causes context to be overwritten #1288

Closed ziggy-cyb closed 2 months ago

ziggy-cyb commented 2 months ago

Description

Previously when fields were exposed to context, if two fields were in the same section, the second field would overwrite the value of the first field. This is due to the way the value object is built for fields in sections, and how Object.assign works.

The ContextComponentCollection.getFormDataFromState function has now been changed so that the context state does not get overwritten anymore.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce the testing if necessary.

Checklist: