Skip to content

Commit 834f9a9

Browse files
committed
Flipped simpleValidationErrors to arrayErrors
1 parent 7d1836c commit 834f9a9

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

packages/core/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ export type FormComponentProps = Partial<
623623
setDefaultsOnSuccess?: boolean
624624
validateFiles?: boolean
625625
validateTimeout?: number
626-
simpleValidationErrors?: boolean
626+
arrayErrors?: boolean
627627
}
628628

629629
export type FormComponentMethods = {

packages/react/src/Form.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const Form = forwardRef<FormComponentRef, ComponentProps>(
6868
invalidateCacheTags = [],
6969
validateFiles = false,
7070
validateTimeout = 1500,
71-
simpleValidationErrors = true,
71+
arrayErrors = false,
7272
children,
7373
...props
7474
},
@@ -86,8 +86,8 @@ const Form = forwardRef<FormComponentRef, ComponentProps>(
8686
)
8787
.setValidationTimeout(validateTimeout)
8888

89-
if (!simpleValidationErrors) {
90-
form.withFullErrors()
89+
if (arrayErrors) {
90+
form.withArrayErrors()
9191
}
9292

9393
form.transform(getTransformedData)

packages/react/test-app/Pages/FormComponent/Precognition/AllErrors.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default () => {
55
<div>
66
<h1>Form Precognition - All Errors</h1>
77

8-
<Form action="/precognition/array-errors" method="post" validateTimeout={100} simpleValidationErrors={false}>
8+
<Form action="/precognition/array-errors" method="post" validateTimeout={100} arrayErrors={true}>
99
{({ invalid, errors, validate, valid, validating }) => (
1010
<>
1111
<div>

packages/svelte/src/components/Form.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
export let setDefaultsOnSuccess: FormComponentProps['setDefaultsOnSuccess'] = false
4343
export let validateFiles: FormComponentProps['validateFiles'] = false
4444
export let validateTimeout: FormComponentProps['validateTimeout'] = 1500
45-
export let simpleValidationErrors: FormComponentProps['simpleValidationErrors'] = true
45+
export let arrayErrors: FormComponentProps['arrayErrors'] = false
4646
4747
type FormSubmitOptions = Omit<VisitOptions, 'data' | 'onPrefetched' | 'onPrefetching'>
4848
@@ -58,8 +58,8 @@
5858
)
5959
.setValidationTimeout(validateTimeout!)
6060
61-
if (!simpleValidationErrors) {
62-
form.withFullErrors()
61+
if (arrayErrors) {
62+
form.withArrayErrors()
6363
}
6464
6565
form.transform(getTransformedData)

packages/svelte/test-app/Pages/FormComponent/Precognition/AllErrors.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
action="/precognition/array-errors"
1010
method="post"
1111
validateTimeout={100}
12-
simpleValidationErrors={false}
12+
arrayErrors={true}
1313
let:invalid
1414
let:errors
1515
let:validate

packages/vue3/src/form.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ const Form = defineComponent({
123123
type: Number as PropType<FormComponentProps['validateTimeout']>,
124124
default: 1500,
125125
},
126-
simpleValidationErrors: {
127-
type: Boolean as PropType<FormComponentProps['simpleValidationErrors']>,
128-
default: true,
126+
arrayErrors: {
127+
type: Boolean as PropType<FormComponentProps['arrayErrors']>,
128+
default: false,
129129
},
130130
},
131131
setup(props, { slots, attrs, expose }) {
@@ -143,8 +143,8 @@ const Form = defineComponent({
143143
.transform(getTransformedData)
144144
.setValidationTimeout(props.validateTimeout)
145145

146-
if (!props.simpleValidationErrors) {
147-
form.withFullErrors()
146+
if (props.arrayErrors) {
147+
form.withArrayErrors()
148148
}
149149

150150
const formElement = ref()

packages/vue3/test-app/Pages/FormComponent/Precognition/AllErrors.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Form } from '@inertiajs/vue3'
1010
action="/precognition/array-errors"
1111
method="post"
1212
:validate-timeout="100"
13-
:simple-validation-errors="false"
13+
array-errors
1414
#default="{ invalid, errors, validate, valid, validating }"
1515
>
1616
<div>

tests/precognition.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ integrations.forEach((integration) => {
170170
await expect(page.getByText('The name contains invalid characters.')).not.toBeVisible()
171171
})
172172

173-
test(prefix + 'shows all errors when simpleValidationErrors is false', async ({ page }) => {
173+
test(prefix + 'shows all errors using array errors', async ({ page }) => {
174174
await page.goto('/' + integration + '/precognition/all-errors')
175175

176176
await page.fill('input[name="name"]', 'ab')

0 commit comments

Comments
 (0)