df-ae-forms-package 1.0.69 → 1.0.70

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.js CHANGED
@@ -5999,6 +5999,16 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
5999
5999
  values[component.id] = '';
6000
6000
  }
6001
6001
  }
6002
+ // CRITICAL: Also store by label and _id so conditional logic can find values.
6003
+ // condition.when stores the component LABEL (set in ConditionalLogicComponent.tsx line 163).
6004
+ // getComponentValue() checks formValues[label] first, so we must populate it here
6005
+ // to ensure show/hide logic evaluates correctly on initial load (before any user interaction).
6006
+ if (component.basic?.label) {
6007
+ values[component.basic.label] = values[component.id];
6008
+ }
6009
+ if (component._id) {
6010
+ values[component._id] = values[component.id];
6011
+ }
6002
6012
  }
6003
6013
  // Handle nested components in table cells
6004
6014
  if (component.cells && Array.isArray(component.cells)) {
@@ -6171,8 +6181,10 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6171
6181
  // Initialize notes and attachments state
6172
6182
  setComponentNotes(prev => ({ ...initialNotes, ...prev }));
6173
6183
  setComponentAttachments(prev => ({ ...initialAttachments, ...prev }));
6174
- // Evaluate initial conditional logic
6175
- evaluateConditionalLogic();
6184
+ // Evaluate initial conditional logic with the freshly computed initialValues.
6185
+ // We pass initialValues explicitly because setFormValues is async and formValues
6186
+ // in the closure is still the old state at this point.
6187
+ evaluateConditionalLogic(initialValues, validatedFormComponents);
6176
6188
  }, [initialFormData, formComponents]);
6177
6189
  // Synchronize component visibility whenever form values or components change
6178
6190
  React.useEffect(() => {