formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.83k stars 1.04k forks source link

Duplicate Rendering of Fields/Labels When Setting Form Submission on Initial Load #5598

Open fuadkhan1996 opened 1 month ago

fuadkhan1996 commented 1 month ago

Describe the bug After updating to the latest version of Formio.js, I am experiencing an issue where form fields and labels are rendered twice when setting the form submission data during the initial load of the form. This issue occurs consistently when using the this.form.submission = { data: data } method right after creating the form. Removing this line results in the form rendering correctly, suggesting that the issue is directly related to setting the submission data

Version/Branch 4.19.2

To Reproduce Steps to reproduce the behavior:

  1. Create a form using Formio.createForm().
  2. Immediately set the form submission using this.form.submission = { data: data }.
  3. Observe that most of the form fields and labels are rendered twice.

Expected behavior Setting the form submission data should only update the form fields with the provided data without causing any additional rendering issues.

Screenshots

image image

Additional context The form fields and labels are duplicated, indicating an extra rendering process is triggered when the form submission is set on the initial load. It's working fine on version 4.16.0.

brendanbond commented 1 month ago

Hi @fuadkhan1996 thanks for reporting this, although I'm unable to reproduce this issue using version 4.19.2. Can you fork the JSFiddle I've provided and help us out with a minimal reproducible example?