Description
Laravel Precognition Plugin Version
0.5.6
Laravel Version
10.41.1
Plugin
Vue w/ Inertia
Description
In #72, support for Inertia transform was added. However, it looks like it does not support renaming keys, or changing the data structure. In fact, it looks like it only supports transforming individual form field values.
If keys are renamed, or the data structure changes when transforming, then validation is not triggered.
I would expect that changing the data structure with transform
is possible and fully supported.
Steps To Reproduce
Implement a form like this:
const form = useForm('patch', '/update', {
document: {
customer: { email: '[email protected]' }
/** other data here **/
}
}).transform((data) => { ...data.document })
<input type="text" v-model="form.document.customer.email" @change="form.validate('customer.email')" />
Changing the email
value will trigger validation all the way until this line:
precognition/packages/vue/src/index.ts
Lines 87 to 90 in 78d440b
It stops here, because the keys in originalInputs
are based on the initial data, without applying the transformer on it.