BearStudio / formiz

🐜 React forms with ease! Composable, headless & with built-in multi steps
https://formiz-react.com/
MIT License
390 stars 50 forks source link

Pristine update on collection remove #207

Closed HugoPerard closed 1 month ago

HugoPerard commented 10 months ago

Describe the bug

When I arrived on a pristine form and I remove a collection item, the pristine still be at true

To Reproduce

In Formiz examples collection page : https://formiz-examples.vercel.app/collection

  1. In form debug on the right, isPristine is true
  2. Remove an item from the collection clicking on a trash icon button
  3. isPristine still true

Expected behavior

The pristine should be break on a collection removal

Additional context

In the current state of the library, there is no possible solution to do this, because form pristine state is defined by fields pristine state so in this case, pristine stay at true because "updated" (removed) field does not exist anymore. So fix this bug requires to add somethings to manage this case, maybe a state on the collection or something else

HugoPerard commented 1 month ago

https://github.com/BearStudio/formiz/releases/tag/%40formiz%2Fcore%402.3.0