@bolttech/form-engine 3.1.1-beta.3 → 3.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ ## [3.1.1] - 2025-06-19
4
+
5
+ ### Bug Fixes
6
+
7
+ - **onFormMount infinite loop**: Fixed an issue where `onFormMount` would fire repeatedly when the parent component re-renders with new callback references (e.g. Builder.io symbol rehydration). A `formMountHasRunRef` guard now ensures the callback executes exactly once per form lifecycle, preventing the setState → rerender → re-subscribe → re-fire loop.
8
+ - **onFormMount condition check**: Fixed incorrect condition in `mountCallback` that checked `formValuesCallbackRefs.current.onMount` (field-level prop) instead of `formValuesCallbackRefs.current.onFormMount` (form-level prop), causing `onFormMount` to never fire.
9
+
10
+ ### Notes
11
+
12
+ - Field-level `onMount` (via `ON_FIELD_MOUNT` event) remains **unguarded** — it continues to fire every time a field becomes visible through visibility conditions, preserving the expected behavior for conditional fields.
13
+
14
+ ## [3.1.0] - 2025-06-02
15
+
16
+ ### Features
17
+
18
+ - **SSR support**: Form instances are now created synchronously during render via `useMemo`, allowing the component tree to produce meaningful HTML on the server
19
+ - **`prefetchedData` prop**: Pass pre-fetched API data to `<Form />` so fields with API configurations have their response caches populated before mount
20
+ - **`iVars` and `initialValues` at creation time**: These are now passed during form instance creation (not just in `useEffect`), making them available for the `FormCore` constructor during SSR
21
+ - **Package metadata**: Added `"sideEffects": false` and `"exports"` field for proper tree-shaking and RSC compatibility
22
+ - **Test infrastructure**: Added Jest configuration and SSR test suite (12 tests)
23
+
24
+ ### How SSR works
25
+
26
+ During server render, the `<Form />` component creates the `FormCore` instance synchronously in `useMemo`. Fields are registered when `AsFormFieldBuilder` mounts on the client via `useEffect`. Static props (non-template) render immediately; template props are stripped by `filterProps` and resolve after hydration when `refreshTemplates` runs.
27
+
28
+ ### What renders during SSR
29
+
30
+ | Content | SSR behavior |
31
+ |---------|-------------|
32
+ | Form structure (`<form>`) | ✅ Rendered |
33
+ | Static props (label, placeholder) | ✅ Rendered |
34
+ | Template props (`${iVars.*}`) | Stripped, resolved after hydration |
35
+ | `visibility: false` fields | ✅ Correctly hidden |
36
+ | Field interactivity | Activates after hydration |