refine
refine copied to clipboard
fix(core): useform onFinishUpdate promise settlement
Issue
This fixes #5460
Description
This PR addresses the issue where the useForm
hook, specifically in the code path for pessimistic mutationMode, had a promise executor that returned without ever calling reject (nor resolve). This resulted in the promise not being settled, causing the onFinishUpdate
promise never to reject (nor resolve).
Changes
The return
statement from line 581 in the useForm hook has been removed to ensure that the promise executor now correctly calls reject after the onMutationError
executes. This adjustment guarantees that the onFinishUpdate
promise is now set to reject, and the form state is restored with isSubmitting
set to false
.
Self Check before Merge
Please check all items below before review.
- [x] Corresponding issues are created/updated or not needed
- [x] Docs are updated/provided or not needed
- [x] Examples are updated/provided or not needed
- [x] TypeScript definitions are updated/provided or not needed
- [ ] Tests are updated/provided or not needed
- [x] Changesets are provided or not needed
🦋 Changeset detected
Latest commit: 8548c4300cc647a0ce144c4cf3916b131809709c
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
☁️ Nx Cloud Report
We didn't find any information for the current pull request with the commit c0fb5b010ac2f454ac86c811bf65378bec61e22c. Please verify you are running the latest version of the NxCloud runner.
Check the Nx Cloud Source Control Integration documentation for more information.
Alternatively, you can contact us at [email protected].
Sent with 💌 from NxCloud.
Hey @ShivamDureja thanks for the PR! We'll be refactoring this hook more throughly, as there are many other issues that needs to be fixed together. We'll handle these issues under issue https://github.com/refinedev/refine/issues/5702.