jupiter-dynamic-forms 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5132,24 +5132,28 @@ let JupiterDynamicForm = class extends LitElement {
5132
5132
  if (preferencesChanged) {
5133
5133
  this._periodPreferences = periodPreferences;
5134
5134
  console.log("📊 Period preferences updated:", this._periodPreferences);
5135
+ console.log("💾 Capturing current form data before reinitialization...");
5136
+ const currentFormData = this._generateSubmissionData();
5137
+ const currentMetadata = this._draftStorageService.createMetadataSnapshot(
5138
+ this.periodStartDate,
5139
+ this.periodEndDate,
5140
+ this.language,
5141
+ this._selectedRoleIds,
5142
+ this._allSections,
5143
+ this._typedMemberData,
5144
+ this._periodPreferences
5145
+ );
5146
+ this._draftStorageService.saveDraft(currentFormData, currentMetadata);
5147
+ console.log("✅ Current form data saved to draft storage");
5135
5148
  this._skipDraftLoading = true;
5136
5149
  this._initializeForm();
5137
5150
  this._skipDraftLoading = false;
5138
- if (this._draftStorageService.hasDraft()) {
5139
- console.log("💾 Updating draft with new period preferences...");
5140
- const draftData = this._generateSubmissionData();
5141
- const metadata = this._draftStorageService.createMetadataSnapshot(
5142
- this.periodStartDate,
5143
- this.periodEndDate,
5144
- this.language,
5145
- this._selectedRoleIds,
5146
- this._allSections,
5147
- this._typedMemberData,
5148
- this._periodPreferences
5149
- );
5150
- this._draftStorageService.saveDraft(draftData, metadata);
5151
- console.log("✅ Draft updated with new period preferences");
5152
- }
5151
+ console.log("📥 Restoring form data from draft after reinitialization...");
5152
+ this._loadDraftIfExists().then(() => {
5153
+ console.log("✅ Form data restored successfully after reinitialization");
5154
+ }).catch((error) => {
5155
+ console.error("❌ Error restoring form data after reinitialization:", error);
5156
+ });
5153
5157
  } else {
5154
5158
  this._applyRoleFilter();
5155
5159
  }