Repository navigation
fix(onboarding): refetch employment after basic info - #1515
Closed
gabrielseco wants to merge 4 commits into
Closed
gabrielseco wants to merge 4 commits into
gabrielseco wants to merge 4 commits into
Conversation
The flow never refetched the employment after updating basic information, so the job title eligibility check kept sending the old job title after an in-session title change. Refetch before moving on so the employment query stays the single source of truth. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (291 total)
✅ Bundle size check passed |
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
Contributor
📊 Coverage Report⚪ Coverage unchanged
Detailed BreakdownLines Coverage
Statements Coverage
Functions Coverage
Branches Coverage
✅ Coverage check passed |
Type the new title into basic information and continue, with the update handler storing the title it receives, instead of calling the flow's submit directly with a handler that ignored the payload. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Serve basicInformationSchemaV1Portugal instead of a hand-built schema, and render the steps only once the flow has loaded so the form starts from the saved employment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The update resolves with an error instead of throwing, so the refetch also ran after a failed save. Guard it, and test that a failed update stays on the step without refetching, and that a successful one only moves on once the refetch has finished. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 of 2 tasks
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 an employer changes the job title in Onboarding and continues, the job title eligibility check now runs against the new title instead of the one loaded when the flow opened.
Why
What changed
Toggle details
hooks.tsx: in the basic information update path, refetch the employment after a successful update and before moving to the next step. The update resolves with{ data, error }instead of throwing, so the refetch is skipped explicitly when it failed. The create path is unchanged, since it sets a new employment id, which fetches fresh anyway.OnboardingFlowJobTitleEligibility.test.tsx, on jsf v0 and v1: type a new title in Basic information and continue, using the real basic information fixture. The flow stays on the step until the refetch finishes, then the check sends the new title.OnboardingFlow.test.tsx: a failed update stays on Basic information and doesn't refetch.Screenshots
N/A
Related Resources
Testing
Each new test was checked by removing the code it covers:
await refetchEmployment()"Software Engineer"instead of"Surgeon"(v0 and v1)await→void refetchEmployment()!response.errorguardexample/app in a browserjob_title_eligibilityfor the check. The refetch itself isn't behind a flag.🤖 Generated with Claude Code
Note
Low Risk
Localized onboarding submit-path change with a refetch after an existing update; adds one GET per basic info save and is covered by a new test.
Overview
Fixes a session bug where job title eligibility on contract details used a stale job title after the user edited basic information in the same onboarding session.
After a successful basic information PATCH, the flow now awaits
refetchEmployment()so cached employment (includingjob_title) matches what was saved before the user continues. The create-employment path is unchanged.A new integration test walks basic information → contract details, changes the title mid-session, and asserts the eligibility check payload uses the updated title (it would still send the old title without the refetch). Expect one extra GET per basic info save; no API contract changes.
Reviewed by Cursor Bugbot for commit a543c0a. Bugbot is set up for automated code reviews on this repo. Configure here.