Refactor form initialization and data management in OpenForm component (#709)

* Refactor form initialization and data management in OpenForm component

- Add resetAndFill method to Form class for more flexible form data handling
- Update initForm method to use nextTick for better reactivity
- Modify form initialization logic to reset and fill form data more consistently
- Remove unnecessary computed import and add debug console.log

* fix on fill again

---------

Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com>
This commit is contained in:
Julien Nahum
2025-03-03 14:29:15 +08:00
committed by GitHub
parent c9dbc79f75
commit 267beec582
2 changed files with 23 additions and 8 deletions

View File

@@ -85,6 +85,17 @@ class Form {
clearTimeout(this.recentlySuccessfulTimeoutId)
}
resetAndFill(data = {}) {
// Clear form state
this.clear()
// Reset and update form data using the existing update method
this.originalData = {}
this.update(data)
return this
}
reset() {
Object.keys(this)
.filter((key) => !Form.ignore.includes(key))