[3.x] Only reset useForm processing and progress with onFinish#2479
[3.x] Only reset useForm processing and progress with onFinish#2479mattwigham wants to merge 3 commits intoinertiajs:3.xfrom
Conversation
|
This is technically a breaking change. Code that checks That said, I think this change makes sense since it aligns with the documented promise behavior. I'll merge this in v3. |
|
@mattwigham Can you tick the 'Allow edits from maintainers' checkbox so I can add more tests? Thanks! |
|
@pascalbaljet I just realized this is from our gh org, so I don't have that option to allow edits. Would you like me to resubmit the PR as a user or do you want to recreate these changes yourself since they're minimal? Sorry for the hassle! |
No problem, I'll open a new PR and add you as co-author! |
Closes #2463
Previously the form helper's onSuccess, onError, onCancel, and onFinish callbacks all set
processing = falseandprogress = null. This PR makes it so that now only happens inonFinish.Aside from the pedantic and DRY reasons to do this, this also helps those of us using the feature of onSuccess and onError where you can return a promise, and onFinish won't be called until it resolves.
I'm using that feature in some forms that do work in a background job, which I poll the status of inside the promise, and this change allows the form's processing to remain true during that entire time and not just the initial submission.