Repository navigation
fix(onboarding): ignore a job title eligibility check superseded by newer values - #1420
Closed
gabrielseco wants to merge 1 commit into
Closed
gabrielseco wants to merge 1 commit into
gabrielseco wants to merge 1 commit into
Conversation
…ewer values When two checks fire before React re-renders, the older query never gets an observer, so React Query doesn't abort it. Its result, or its failure, then overwrote the newer check's values. check() now resolves with undefined when the params it sent are no longer the latest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (75 total)
✅ Bundle size check passed |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
Contributor
📊 Coverage Report✅ Coverage increased! 🎉
Detailed BreakdownLines Coverage
Statements Coverage
Functions Coverage
Branches Coverage
✅ Coverage check passed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
If a custom onboarding UI starts a second job title eligibility check before the first one finishes, the older check's result can no longer overwrite the newer one's.
Why
Cursor Bugbot flagged this on #1417. It only reproduces when
checkJobTitleEligibilityis called twice before React re-renders. Today the only caller is the prebuilt form'sonBlur. There, React Query already aborts a superseded check, because a re-render always happens between user-driven blurs.Parked as a separate PR so we can decide later whether we need it, for example if partners end up calling
checkJobTitleEligibilitythemselves.What changed
Toggle details
useJobTitleEligibilityCheck.tsx: once the request settles,check()compares the params it sent with the latest ones (paramsRef). If they differ, it resolves withundefinedinstead of the result, or instead of cleared values on failure, and it skips the error log. The prebuilt form writes nothing forundefined.useQueryobserver goes away. Two back-to-back calls leave the first query without any observer, so nothing cancels it. The same happens if its response lands before the re-render that would switch the observer.undefinedwhen a newer check superseded it") hold regardless of render timing.Screenshots
N/A
Related Resources
Testing
example/app in a browserjob_title_eligibility🤖 Generated with Claude Code