-
-
Notifications
You must be signed in to change notification settings - Fork 569
fix(form-core): prevent double re-render when no async validators #1929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(form-core): prevent double re-render when no async validators #1929
Conversation
Fields were re-rendering twice on each keystroke because `isValidating` was being toggled (true -> false) even when there were no async validators. This fix checks if there are actual async validators before setting `isValidating` state, preventing unnecessary re-renders. Fixes TanStack#1130
🦋 Changeset detectedLatest commit: e77c124 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
crutchcorn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for this!
|
View your CI Pipeline Execution ↗ for commit e77c124
☁️ Nx Cloud last updated this comment at |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1929 +/- ##
==========================================
- Coverage 90.35% 89.74% -0.61%
==========================================
Files 38 48 +10
Lines 1752 1931 +179
Branches 444 483 +39
==========================================
+ Hits 1583 1733 +150
- Misses 149 177 +28
- Partials 20 21 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
isValidatingdoesn't toggle unnecessarilyProblem
As reported in #1130, fields were re-rendering twice on each keystroke because
isValidatingwas being set totruethen immediatelyfalseinvalidateAsync, even when there were no async validators to run.Root Cause
In
FieldApi.validateAsync:Solution
Check if there are actual async validators before toggling
isValidating:Test Plan
should not toggle isValidating when there are no async validatorsFixes #1130