Skip to content

Commit c9bf9a7

Browse files
committed
docs(forms): use the when option in disabled examples
Passing a function or string directly to `disabled()` is deprecated in favor of `{when: ...}`. The `SchemaFn` API example, the schemas guide diagram and an internal comment still showed the deprecated form. Built with `//adev:build`.
1 parent c0dc8c4 commit c9bf9a7

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎adev/src/content/guide/forms/signals/schemas.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ contactForm = form(this.contactModel, (schemaPath) => {
1919
graph TD
2020
A["form(model, schemaFn)"] --> B["Schema function runs ONCE"]
2121
B --> C["required(path)"]
22-
B --> D["disabled(path, logicFn)"]
22+
B --> D["disabled(path, {when: logicFn})"]
2323
B --> E["validate(path, logicFn)"]
2424
B --> F["apply(path, schema)"]
2525
C --> G["Reactive: recomputes on signal change"]

‎packages/forms/signals/src/api/types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ export type Schema<in TModel> = {
835835
* ```typescript
836836
* const userFormSchema: SchemaFn<User> = (p) => {
837837
* required(p.name);
838-
* disabled(p.email, ({valueOf}) => valueOf(p.name) === '');
838+
* disabled(p.email, {when: ({valueOf}) => valueOf(p.name) === ''});
839839
* };
840840
*
841841
* const f = form(userModel, userFormSchema, {injector});

‎packages/forms/signals/src/field/resolution.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function getBoundPathDepth() {
2626
*
2727
* ```ts
2828
* const s = schema(p => {
29-
* disabled(p.next, ({valueOf}) => valueOf(p.data));
29+
* disabled(p.next, {when: ({valueOf}) => valueOf(p.data)});
3030
* apply(p.next, s);
3131
* });
3232
* ```

0 commit comments

Comments
 (0)