@assembly-js/app-foundation 0.14.1 → 0.14.2

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 CHANGED
@@ -19,6 +19,9 @@ A patch release never changes what an app's build requires; a minor release may
19
19
  not by hand; see `changes/README.md`. CI fails a PR that changes a check script without a
20
20
  `bump: minor` change file.
21
21
 
22
+ ## 0.14.2
23
+ - [guidance] The build agent now keeps each row's own id in forms with add-and-remove rows (answer options, line items), so a selected row is no longer rejected as missing.
24
+
22
25
  ## 0.14.1
23
26
  - [guidance] The build agent is taught that a call to another app through the installer client or a raw `fetch` carries the client in a client's request, that the platform can refuse it with `viewer_cannot_open_app`, and which cases the check does not cover; a route that allows only app callers answers a client who arrives through another app with 403, so it must list `client` to admit them; a `check-app-only-routes: intended` comment only tells the check script that a route should stay app-only.
24
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assembly-js/app-foundation",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "Versioned foundation helpers and build context for Assembly generated apps",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: assembly-forms
3
- description: Use when the app has multi-field forms that need client-side validation with per-field error messages. Covers react-hook-form + zod + Assembly UI Field component. NOT the Assembly Forms/intake module — for that (surveys, intake) use the SDK's listForms/retrieveForm/requestFormResponse instead.
3
+ description: Use when the app has multi-field forms that need client-side validation with per-field error messages. Covers react-hook-form + zod + Assembly UI Field component, and useFieldArray rows that carry their own id (answer options, line items). NOT the Assembly Forms/intake module — for that (surveys, intake) use the SDK's listForms/retrieveForm/requestFormResponse instead.
4
4
  ---
5
5
 
6
6
  ## Install
@@ -95,6 +95,20 @@ The installed zod is v4. Use the v4 idioms below; the v3 forms are deprecated (t
95
95
  - Flatten/format issues with the top-level `z.flattenError(err)` / `z.treeifyError(err)` — **not** `err.flatten()` / `err.format()`. Reading `err.issues` directly is fine.
96
96
  - Import from `'zod'` (top-level) — **not** the `'zod/v4'` subpath.
97
97
 
98
+ ## Dynamic rows: `useFieldArray` replaces each row's `id`
99
+
100
+ `useFieldArray` writes its own generated key into every entry of `fields` under `id`, replacing an `id` the row already has (a database id, an option id another field points at). The form values keep the row's real id, so a value read from `field.id` (a radio `value`, a `correctOptionId`, a remove-by-id) matches no row and validation rejects a visibly selected answer. Pass `keyName: 'key'` whenever rows carry their own `id`:
101
+
102
+ ```tsx
103
+ // ❌ field.id is react-hook-form's generated key, not the option's id
104
+ const { fields } = useFieldArray({ control, name: 'options' });
105
+ <RadioGroupItem key={field.id} value={field.id} />
106
+
107
+ // ✅ field.key is the generated key; field.id stays the option's id
108
+ const { fields } = useFieldArray({ control, name: 'options', keyName: 'key' });
109
+ <RadioGroupItem key={field.key} value={field.id} />
110
+ ```
111
+
98
112
  ## Key patterns
99
113
 
100
114
  - `data-invalid={!!errors.fieldName}` on `Field` triggers destructive (red) styling on the label and input border