-
Notifications
You must be signed in to change notification settings - Fork 42
Vue-Inertia: Precognition-enabled Inertia Form component #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vue-Inertia: Precognition-enabled Inertia Form component #128
Conversation
There seems to be a lot of unrelated changes here making it extremely hard to review. Marking this one as draft until it is in a better spot. Can you please revert any changes that are not specific to adding the new I would also hope that we can, like with did with Thanks for the PR. Will be a good addition. |
@timacdonald Thank you for the reply. I agree with this PR not being in a good state, I should have marked it as a draft, my bad. |
f17629b
to
bd2d9f3
Compare
Hey, @kaspernowak, there still seems to be a lot of formatting and type changes in here unrelated to the feature. An example of a formatting change that is causing a bigger diff: - validateFiles(): Data & Form<Data>,
+ validateFiles(): Data & Form<Data>; There are type changes to utilise types from Inertia. While I think this is generally good, it makes the changes hard to grok for this feature. If they aren't required, can we please revert them as well? Any type changes that remain, we will need to check compatibility with currently supported versions of Inertia in Precognition or drop support for them and push the requirement forward. |
@timacdonald This PR should now be easier to review, with only essential changes to pass typechecks for the vue-inertia package. I also added a PR in the inertajs/inertia github repo, which follows a different approach, by supporting live validation from the inertia Form component directly, driven by live validation providers like Laravel Precognition. |
@timacdonald I did not see your comment before I posted mine. |
e38e38e
to
04b2ff6
Compare
04b2ff6
to
c45ca5d
Compare
@timacdonald I removed the formatting changes (I hope) and reverted the usage of the I found it hard to get the vue-inertia package to build without implementing the FormDataKeys, FormDataType, FormDataErrors, and ErrorValue types from @inertiajs/core, so I kept those. |
Drafting until ready for review. cc @timacdonald |
@taylorotwell Do you have a preference between the provider driven live validation in the inertia form approach and this thin wrapper around the inertia form approach? |
@timacdonald Would you prefer that I ignored any TS errors with |
@kaspernowak, thanks for your work on this. I am going to close this PR as we have an alternative path we are taking to bring the form component to Precognition. Appreciate you getting us moving on this one. |
@timacdonald Thank you, do you have an estimate of when we can expect precognition to work with the form component? |
No estimate, yet. |
Motivation
Laravel 12 starter kits have moved from the Inertia useForm helper to the Inertia
<Form>
component. Inertia’s<Form>
component does not support Precognition out of the box, making the Laravel 12 Vue starter kits incompatible with Laravel Precognition. This PR adds a thin wrapper over Inertia’s<Form>
component to bridge that gap.Key points
<PrecognitionForm>
(re-export of named [Form] with live validation built-in.Props
Per-field opt-in
precognitive
ordata-precognitive="true"
on inputs to validate that field (even ifprecognitive=false
globally).Usage: global live validation
Usage: per-field opt-in + faster debounce
Usage: custom ValidationConfig (headers, hook)
Notes
validationTimeout
for UX.