Skip to content

Commit d2f4bb2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix/file-input-field-picking-a-different-file-does-not-trigger-rerender
2 parents 1ae9f5c + e21cc01 commit d2f4bb2

File tree

189 files changed

+5613
-1670
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+5613
-1670
lines changed

.github/workflows/autofix.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout
29-
uses: actions/[email protected].1
29+
uses: actions/[email protected].2
3030
- name: Setup Tools
31-
uses: tanstack/config/.github/setup@main
31+
uses: TanStack/config/.github/setup@main
3232
- name: Fix formatting
3333
run: pnpm format
3434
- name: Generate Docs
3535
if: ${{ github.event_name == 'push' || github.event.inputs.generate-docs == true }}
3636
run: pnpm generate-docs
3737
- name: Apply fixes
38-
uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27
38+
uses: autofix-ci/action@7a166d7532b277f34e16238930461bf77f9d7ed8
3939
with:
4040
commit-message: 'ci: apply automated fixes and generate docs'

.github/workflows/pr.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name: PR
22

33
on:
44
pull_request:
5-
paths-ignore:
6-
- 'docs/**'
7-
- 'media/**'
8-
- '**/*.md'
95

106
concurrency:
117
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
@@ -16,20 +12,21 @@ env:
1612

1713
permissions:
1814
contents: read
15+
pull-requests: write
1916

2017
jobs:
2118
test:
2219
name: Test
2320
runs-on: ubuntu-latest
2421
steps:
2522
- name: Checkout
26-
uses: actions/[email protected].1
23+
uses: actions/[email protected].2
2724
with:
2825
fetch-depth: 0
2926
- name: Start Nx Agents
3027
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
3128
- name: Setup Tools
32-
uses: tanstack/config/.github/setup@main
29+
uses: TanStack/config/.github/setup@main
3330
- name: Get base and head commits for `nx affected`
3431
uses: nrwl/[email protected]
3532
with:
@@ -50,11 +47,9 @@ jobs:
5047
runs-on: ubuntu-latest
5148
steps:
5249
- name: Checkout
53-
uses: actions/[email protected]
54-
with:
55-
fetch-depth: 0
50+
uses: actions/[email protected]
5651
- name: Setup Tools
57-
uses: tanstack/config/.github/setup@main
52+
uses: TanStack/config/.github/setup@main
5853
- name: Build Packages
5954
run: pnpm run build:all
6055
- name: Publish Previews
@@ -64,10 +59,18 @@ jobs:
6459
runs-on: ubuntu-latest
6560
steps:
6661
- name: Checkout
67-
uses: actions/[email protected]
68-
with:
69-
fetch-depth: 0
62+
uses: actions/[email protected]
7063
- name: Check Provenance
7164
uses: danielroe/[email protected]
7265
with:
7366
fail-on-downgrade: true
67+
version-preview:
68+
name: Version Preview
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout
72+
uses: actions/[email protected]
73+
- name: Setup Tools
74+
uses: TanStack/config/.github/setup@main
75+
- name: Changeset Preview
76+
uses: TanStack/config/.github/changeset-preview@main

.github/workflows/release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,23 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Checkout
26-
uses: actions/[email protected].1
26+
uses: actions/[email protected].2
2727
with:
2828
fetch-depth: 0
2929
- name: Setup Tools
30-
uses: tanstack/config/.github/setup@main
30+
uses: TanStack/config/.github/setup@main
3131
- name: Run Tests
3232
run: pnpm run test:ci
3333
- name: Run Changesets (version or publish)
34-
uses: changesets/[email protected]
34+
id: changesets
35+
uses: changesets/[email protected]
3536
with:
3637
version: pnpm run changeset:version
3738
publish: pnpm run changeset:publish
3839
commit: 'ci: Version Packages'
3940
title: 'ci: Version Packages'
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
- name: Comment on PRs about release
42+
if: steps.changesets.outputs.published == 'true'
43+
uses: TanStack/config/.github/comment-on-release@main
44+
with:
45+
published-packages: ${{ steps.changesets.outputs.publishedPackages }}

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ A headless form library for managing complex form state with full control over f
5757

5858
<table align="center">
5959
<tr>
60-
<td>
61-
<a href="https://www.coderabbit.ai/?via=tanstack&dub_id=aCcEEdAOqqutX6OS">
62-
<picture>
63-
<source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/coderabbit-dark-CMcuvjEy.svg" height="40" />
64-
<source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/coderabbit-light-DVMJ2jHi.svg" height="40" />
65-
<img src="https://tanstack.com/assets/coderabbit-light-DVMJ2jHi.svg" height="40" alt="CodeRabbit" />
66-
</picture>
67-
</a>
60+
<td>
61+
<a href="https://www.coderabbit.ai/?via=tanstack&dub_id=aCcEEdAOqqutX6OS" >
62+
<picture>
63+
<source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/coderabbit-dark-D643Zkrv.svg" />
64+
<source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg" />
65+
<img src="https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg" height="40" alt="CodeRabbit" />
66+
</picture>
67+
</a>
6868
</td>
69-
<td padding="20">
69+
<td>
7070
<a href="https://www.cloudflare.com?utm_source=tanstack">
71-
<picture>
72-
<source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/cloudflare-white-DQDB7UaL.svg" height="60" />
73-
<source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/cloudflare-black-CPufaW0B.svg" height="60" />
74-
<img src="https://tanstack.com/assets/cloudflare-black-CPufaW0B.svg" height="60" alt="Cloudflare" />
75-
</picture>
71+
<picture>
72+
<source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg" />
73+
<source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/cloudflare-black-6Ojsn8yh.svg" />
74+
<img src="https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg" height="60" alt="Cloudflare" />
75+
</picture>
7676
</a>
7777
</td>
7878
</tr>

docs/framework/angular/guides/arrays.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Finally, you can use a subfield like so:
6666
</ng-container>
6767
```
6868

69-
Where `getPeopleName` is a method on the class like so
69+
Where `getPeopleName` is a method on the class like so:
7070

7171
```typescript
7272
export class AppComponent {

docs/framework/lit/guides/arrays.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ return html`
8686
export class TestForm extends LitElement {
8787
#form = new TanStackFormController(this, {
8888
defaultValues: {
89-
people: [] as Array<{ name: string}>,
89+
people: [] as Array<{ name: string }>,
9090
},
9191
});
9292
render() {

docs/framework/lit/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class TestForm extends LitElement {
4646
},
4747
})
4848
render() {
49-
return html` <p>Please enter your first name></p>
49+
return html` <p>Please enter your first name</p>
5050
${this.#form.field(
5151
{
5252
name: `firstName`,

docs/framework/react/guides/async-initial-values.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function App() {
4040
},
4141
})
4242

43-
if (isLoading) return <p>Loading..</p>
43+
if (isLoading) return <p>Loading...</p>
4444

4545
return (
4646
// ...

docs/framework/react/guides/basic-concepts.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This page introduces the basic concepts and terminology used in the `@tanstack/r
77

88
## Form Options
99

10-
You can create options for your form so that it can be shared between multiple forms by using the `formOptions` function.
10+
You can customize your form by creating configuration options with the `formOptions` function. These options can be shared between multiple forms.
1111

1212
Example:
1313

@@ -26,7 +26,7 @@ const formOpts = formOptions({
2626

2727
## Form Instance
2828

29-
A Form Instance is an object that represents an individual form and provides methods and properties for working with the form. You create a form instance using the `useForm` hook provided by the form options. The hook accepts an object with an `onSubmit` function, which is called when the form is submitted.
29+
A Form instance is an object that represents an individual form and provides methods and properties for working with the form. You create a Form instance using the `useForm` hook provided by the form options. The hook accepts an object with an `onSubmit` function, which is called when the form is submitted.
3030

3131
```tsx
3232
const form = useForm({
@@ -38,7 +38,7 @@ const form = useForm({
3838
})
3939
```
4040

41-
You may also create a form instance without using `formOptions` by using the standalone `useForm` API:
41+
You may also create a Form instance without using `formOptions` by using the standalone `useForm` API:
4242

4343
```tsx
4444
interface User {
@@ -59,7 +59,7 @@ const form = useForm({
5959

6060
## Field
6161

62-
A Field represents a single form input element, such as a text input or a checkbox. Fields are created using the form.Field component provided by the form instance. The component accepts a name prop, which should match a key in the form's default values. It also accepts a children prop, which is a render prop function that takes a field object as its argument.
62+
A Field represents a single form input element, such as a text input or a checkbox. Fields are created using the `form.Field` component provided by the Form instance. The component accepts a `name` prop, which should match a key in the form's default values. It also accepts a `children` prop, which is a render prop function that takes a `field` object as its argument.
6363

6464
Example:
6565

@@ -79,7 +79,7 @@ Example:
7979
/>
8080
```
8181

82-
If you run into issues handing in children as props, make sure to check your linting rules.
82+
If you run into issues handling `children` as props, make sure to check your linting rules.
8383

8484
Example (ESLint):
8585

@@ -107,12 +107,13 @@ const {
107107
} = field.state
108108
```
109109

110-
There are four states in the metadata that can be useful to see how the user interacts with a field:
110+
There are four states in the metadata that can be useful for seeing how the user interacts with a field:
111111

112-
- _"isTouched"_, after the user changes the field or blurs the field
113-
- _"isDirty"_, after the field's value has been changed, even if it's been reverted to the default. Opposite of `isPristine`
114-
- _"isPristine"_, until the user changes the field value. Opposite of `isDirty`
115-
- _"isBlurred"_, after the field has been blurred
112+
- **isTouched**: is `true` once the user changes or blurs the field
113+
- **isDirty**: is `true` once the field's value is changed, even if it's reverted to the default. Opposite of `isPristine`
114+
- **isPristine**: is `true` until the user changes the field's value. Opposite of `isDirty`
115+
- **isBlurred**: is `true` once the field loses focus (is blurred)
116+
- **isDefaultValue**: is `true` when the field's current value is the default value
116117

117118
```ts
118119
const { isTouched, isDirty, isPristine, isBlurred } = field.state.meta
@@ -132,14 +133,12 @@ Persistent `dirty` state
132133
- **Libraries**: Angular Form, Vue FormKit.
133134
- **Behavior**: A field remains 'dirty' once changed, even if reverted to the default value.
134135

135-
We have chosen the persistent 'dirty' state model. To also support a non-persistent 'dirty' state, we introduce an additional flag:
136-
137-
- _"isDefaultValue"_, whether the field's current value is the default value
136+
We have chosen the persistent 'dirty' state model. However, we have introduced the `isDefaultValue` flag to also support a non-persistent 'dirty' state.
138137

139138
```ts
140139
const { isDefaultValue, isTouched } = field.state.meta
141140

142-
// The following line will re-create the non-Persistent `dirty` functionality.
141+
// The following line will re-create the non-persistent `dirty` functionality.
143142
const nonPersistentIsDirty = !isDefaultValue
144143
```
145144

@@ -290,7 +289,7 @@ More information can be found at [Listeners](./listeners.md)
290289

291290
Array fields allow you to manage a list of values within a form, such as a list of hobbies. You can create an array field using the `form.Field` component with the `mode="array"` prop.
292291

293-
When working with array fields, you can use the fields `pushValue`, `removeValue`, `swapValues` and `moveValue` methods to add, remove, swap, and move a value from one index to another within the array, respectively. Additional helper methods such as `insertValue`, `replaceValue`, and `clearValues` are also available for inserting, replacing, and clearing array values.
292+
When working with array fields, you can use the `pushValue`, `removeValue`, `swapValues`, and `moveValue` methods to add, remove, swap, and move a value from one index to another within the array, respectively. Additional helper methods such as `insertValue`, `replaceValue`, and `clearValues` are also available for inserting, replacing, and clearing array values.
294293

295294
Example:
296295

@@ -370,7 +369,7 @@ Example:
370369

371370
## Reset Buttons
372371

373-
When using `<button type="reset">` in conjunction with TanStack Form's `form.reset()`, you need to prevent the default HTML reset behavior to avoid unexpected resets of form elements (especially `<select>` elements) to their initial HTML values.
372+
When using `<button type="reset">` with TanStack Form's `form.reset()`, you need to prevent the default HTML reset behavior to avoid unexpected resets of form elements (especially `<select>` elements) to their initial HTML values.
374373
Use `event.preventDefault()` inside the button's `onClick` handler to prevent the native form reset.
375374

376375
Example:

docs/framework/react/guides/custom-errors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Custom Errors
55

66
TanStack Form provides complete flexibility in the types of error values you can return from validators. String errors are the most common and easy to work with, but the library allows you to return any type of value from your validators.
77

8-
As a general rule, any truthy value is considered as an error and will mark the form or field as invalid, while falsy values (`false`, `undefined`, `null`, etc..) mean there is no error, the form or field is valid.
8+
As a general rule, any truthy value is considered an error and will mark the form or field as invalid, while falsy values (`false`, `undefined`, `null`, etc.) mean there is no error, and the form or field is valid.
99

1010
## Return String Values from Forms
1111

@@ -133,7 +133,7 @@ Display in UI:
133133
}
134134
```
135135

136-
in the example above it depends on the event error you want to display.
136+
In the example above, the rendered message, code and styling depend on the event error you want to display.
137137

138138
### Arrays
139139

@@ -171,7 +171,7 @@ Display in UI:
171171

172172
## The `disableErrorFlat` Prop on Fields
173173

174-
By default, TanStack Form flattens errors from all validation sources (onChange, onBlur, onSubmit) into a single `errors` array. The `disableErrorFlat` prop preserves the error sources:
174+
By default, TanStack Form flattens errors from all validation sources (`onChange`, `onBlur`, `onSubmit`) into a single `errors` array. The `disableErrorFlat` prop preserves the error sources:
175175

176176
```tsx
177177
<form.Field

0 commit comments

Comments
 (0)