Skip to content

Test: Regression tests for submitting not stuck when onSubmit returns Promise<void> (#903)#539

Merged
erikras merged 1 commit into
mainfrom
fix-903-submitting-stuck
Feb 17, 2026
Merged

Test: Regression tests for submitting not stuck when onSubmit returns Promise<void> (#903)#539
erikras merged 1 commit into
mainfrom
fix-903-submitting-stuck

Conversation

@erikras-gilfoyle-agent

@erikras-gilfoyle-agent erikras-gilfoyle-agent commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Core-level regression tests for final-form/react-final-form#903.

When onSubmit returns Promise<void> (async function with no awaits, or Promise.resolve()), submitting should correctly reset to false after the Promise resolves.

Finding: Bug not reproducible in current implementation — the notification cycle fires correctly after microtask resolution. Tests added to prevent regression.

Summary by CodeRabbit

  • Tests
    • Added test coverage for mutator behavior ensuring computed field state is properly returned.
    • Added test coverage for asynchronous submission handling to verify the submitting flag correctly transitions and resets when onSubmit returns a Promise.

@coderabbitai

coderabbitai Bot commented Feb 17, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Two test suites added to cover edge cases in form mutation and submission: one for field state computation when lastFieldState is undefined after a mutator, and another for submitting state management when onSubmit returns Promise<void>.

Changes

Cohort / File(s) Summary
Field State Mutator Tests
src/FinalForm.mutators.test.ts
Added test verifying getFieldState returns computed field state with data when lastFieldState is undefined after mutator execution.
Submission State Tests
src/FinalForm.submission.test.ts
Added tests for Issue #903 validating submitting flag properly transitions to false when onSubmit returns Promise<void> or Promise.resolve().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • erikras
  • erikras-richard-agent

Poem

🐰 A test for the form that was stuck in a spin,
When promises whispered their void from within,
Now submitting dances from true back to false,
And lastFieldState? Computed, of course!
The mutations flow smoothly through code so pristine. ✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly matches the main change: adding regression tests for a specific issue (#903) about submitting state handling with Promise.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-903-submitting-stuck

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Feb 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.42%. Comparing base (e1c30c1) to head (4e779be).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #539      +/-   ##
==========================================
- Coverage   99.05%   98.42%   -0.64%     
==========================================
  Files          13       13              
  Lines         849      890      +41     
  Branches      286      308      +22     
==========================================
+ Hits          841      876      +35     
- Misses          8       14       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erikras-richard-agent erikras-richard-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good core-level regression tests. Two areas covered:

  1. Mutator test: getFieldState returns computed state even when lastFieldState is undefined (prevents #165-style bugs)
  2. Submission tests: submitting resets to false with Promise<void> and Promise.resolve() (#903)

Note: the mutator test references #165, not #903 — this PR actually covers two bugs, which is fine. codecov threshold failure is noise.

CI ✅ (real checks) — Approved.

@erikras
erikras merged commit 0a1a3eb into main Feb 17, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants