fix: yield to paint before submit validation so isSubmitting UI shows#2209
fix: yield to paint before submit validation so isSubmitting UI shows#2209hemraj-007 wants to merge 2 commits into
Conversation
Fixes TanStack#1967 by awaiting a browser paint cycle after setting isSubmitting and before onSubmitAsync runs, so loading spinners render in time. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new ChangesBrowser Paint Timing for Form Submission
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/form-core/src/utils.ts`:
- Around line 748-751: The docstring above the yield utility (the comment
beginning "Yields so UI updates (e.g. isSubmitting spinners) can paint before
submit validation runs. Uses double requestAnimationFrame in browsers and
setTimeout(0) elsewhere (tests, SSR).") is inaccurate: the implementation uses
queueMicrotask for the non-browser/test fallback. Update that docstring to
reflect the actual behavior by replacing "setTimeout(0)" with "queueMicrotask
(microtask queue)" and optionally note that tests/SSR use queueMicrotask rather
than macrotask timing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e19336ce-dcfc-4e89-905a-60a53248cc41
📒 Files selected for processing (6)
.changeset/is-submitting-paint.mdpackages/form-core/src/FormApi.tspackages/form-core/src/FormGroupApi.tspackages/form-core/src/utils.tspackages/form-core/tests/utils.spec.tspackages/react-form/tests/useForm.test.tsx
Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes #1967 by awaiting a browser paint cycle after setting isSubmitting and before onSubmitAsync runs, so loading spinners render in time.
🎯 Changes
✅ Checklist
pnpm test:pr.🚀 Release Impact
Summary by CodeRabbit
New Features
Tests
Chores