cds-snc / platform-forms-client

NextJS application that serves the public-facing website for Forms
https://forms-staging.cdssandbox.xyz/
MIT License
28 stars 12 forks source link

Fix the "More" Modal Pushing Data up and Down #3868

Closed ShadeWyrm closed 1 week ago

ShadeWyrm commented 1 week ago

Fixes #3867

Learning :

Fully uncontrolled — in this case your custom would take defaultChecked as a prop, and pass it to DOM . The state would be inside the component itself. The prop value would only ever be used once, when the component is first rendered, and then ignored. The parent would have no way to "force" that state to become something else. If you ever need to reset the input, you'd have to mount it with a different key.

TL;DR : If you want a checkbox to change across components, change it's "key" value (eg: key="{the things id}+{checked or not}"


To test:

  1. Create a form.
  2. Add a Question
  3. Edit the Title, and the Required checkbox.
  4. Note the values, and then click the "More" modal. The values should be the same. Edit them in the Modal.
  5. Click save in the Modal.
  6. Note the values, they should match what you changed. Edit the values again. Open the Modal, they should match again.
github-actions[bot] commented 1 week ago

:test_tube: Review environment

https://ifxh4lqsy7tiiskda3xa3fi6ce0opech.lambda-url.ca-central-1.on.aws/