Beautiful Open-Source Form Builder
Enhance Form class with resetAndFill method improvements (#891)
Chirag Chhatralaaaf665db4075
diff --git a/client/composables/lib/vForm/Form.js b/client/composables/lib/vForm/Form.jsindex 665ae5b26..abbd2939d 100644--- a/client/composables/lib/vForm/Form.js+++ b/client/composables/lib/vForm/Form.js@@ -88,7 +88,16 @@ class Form {resetAndFill(data = {}) {// Clear form statethis.clear()-++ // Remove any previously set keys that are not present in the incoming data+ // This avoids stale values when switching contexts (e.g., viewing different submissions)+ const incomingKeys = new Set(Object.keys(data || {}))+ this.keys()+ .filter((key) => !incomingKeys.has(key))+ .forEach((key) => {+ delete this[key]+ })+// Reset and update form data using the existing update methodthis.originalData = {}this.update(data)