@bolttech/form-engine 3.1.1-beta.2 → 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 +36 -0
- package/README.md +337 -88
- package/index.d.ts +326 -0
- package/index.esm.js +618 -2055
- package/package.json +18 -7
- package/index.esm.d.ts +0 -1
- package/src/components/AsFormField/AsFormField.d.ts +0 -13
- package/src/components/AsFormField/AsFormField.type.d.ts +0 -9
- package/src/components/AsFormFieldBuilder/AsFormFieldBuilder.d.ts +0 -11
- package/src/components/AsFormFieldBuilder/AsFormFieldBuilder.type.d.ts +0 -21
- package/src/components/FieldWrapper/FieldWrapper.d.ts +0 -11
- package/src/components/FieldWrapper/FieldWrapper.type.d.ts +0 -32
- package/src/components/Form/Form.d.ts +0 -9
- package/src/components/Form/Form.type.d.ts +0 -11
- package/src/components/index.d.ts +0 -3
- package/src/context/FormGroupContext.d.ts +0 -19
- package/src/context/FormGroupContext.type.d.ts +0 -48
- package/src/generators/formBuilder.d.ts +0 -9
- package/src/helpers/helpers.d.ts +0 -7
- package/src/helpers/mapper.d.ts +0 -8
- package/src/hooks/index.d.ts +0 -2
- package/src/hooks/useForm/useForm.d.ts +0 -7
- package/src/hooks/useForm/useForm.type.d.ts +0 -12
- package/src/hooks/useFormGroup/useFormGroup.d.ts +0 -4
- package/src/hooks/useFormGroup/useFormGroup.type.d.ts +0 -17
- package/src/index.d.ts +0 -5
- package/src/types/index.d.ts +0 -32
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 |
|