Skip to content

[3.x] Only reset useForm processing and progress with onFinish#2479

Closed
mattwigham wants to merge 3 commits intoinertiajs:3.xfrom
heysupertape:master
Closed

[3.x] Only reset useForm processing and progress with onFinish#2479
mattwigham wants to merge 3 commits intoinertiajs:3.xfrom
heysupertape:master

Conversation

@mattwigham
Copy link
Copy Markdown
Contributor

Closes #2463

Previously the form helper's onSuccess, onError, onCancel, and onFinish callbacks all set processing = false and progress = null. This PR makes it so that now only happens in onFinish.

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.

@pascalbaljet pascalbaljet changed the title Only reset useForm processing and progress with onFinish [3.x] Only reset useForm processing and progress with onFinish Jan 8, 2026
@pascalbaljet pascalbaljet added the next major release We need to consider this for the next major release, perhaps because of a breaking change label Jan 8, 2026
@pascalbaljet
Copy link
Copy Markdown
Member

This is technically a breaking change. Code that checks form.processing inside onSuccess/onError would now see true instead of false. For example, if you're showing a spinner based on processing within those callbacks, it would still be visible until onFinish fires.

That said, I think this change makes sense since it aligns with the documented promise behavior. I'll merge this in v3.

@pascalbaljet pascalbaljet changed the base branch from master to 3.x January 8, 2026 09:04
@pascalbaljet pascalbaljet marked this pull request as draft January 20, 2026 12:49
@pascalbaljet
Copy link
Copy Markdown
Member

@mattwigham Can you tick the 'Allow edits from maintainers' checkbox so I can add more tests? Thanks!

@mattwigham
Copy link
Copy Markdown
Contributor Author

@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!

@pascalbaljet
Copy link
Copy Markdown
Member

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next major release We need to consider this for the next major release, perhaps because of a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useForm processing and progress should only be reset in onFinish

2 participants